cutshort
TRANSCRIPT
CutShort A Hybrid Sorting Technique
BY:Ashish Garg
Versha Garg Sudhir Goswami
What is a Sorting technique ?
Sorting is a process that organizes a collection of data into either ascending or descending order.
Some sorting algorithms Insertion Sort Merge Sort Quick Sort
Importance of Sorting
Data searching can be optimized to a very high level if data is sorted.
Sorting is also done to represent data in more readable formats.
Used in other important algorithms.
Motive
Dividing an input array into a number of sub-arrays so as to reduce the length of the array for performing sorting on individual sub-array.
6512 45 451 12 15 54 3 502 1 335 2 5795
1 2 3 12 15 54 45 502 451 335 6512 5795
Getting the counts of numbers requiring the same number of bits (BitCount) in its binary form
Arranging the numbers such that numbers with same BitCount belong a same sub-arrays
Sorting the sub-arrays with pre-existing sorting technique
Process
Number Binary Representation No. of bits required
12 1010 4
53 110101 6
500 111110100 9
9999 10011100001111 14
BitCounts
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
6512 45 451 12 15 54 3 502 1 335 2 5795
0 1 2 0 2 0 2 0 0 3 0 0 0 2 0
BitBand
Finding BitCount
Array “ BitBand ” : Each element represents the counts of numbers with same BitCount
6512 45 451 12 15 54 3 502 1 335 2 5795
1 3 2 12 15 54 45 451 502 335 6512 5795
Arranging the elements
Sorting sub-arrays
1 3 2 12 15 54 45 451 502 335 6512 5795
1 2 3 12 15 45 54 335 451 502 5795 6512
Complexity
Factor ‘ d ’ is the number of sub-array after performing the CutShort pre-processing step.
Best case: T(n) = O( n.log (n / dmax ))
Average Case: T(n) = O( n.log n/d )
Worst case: T(n) = O( n.log n )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 210
0.01
0.02
0.03
0.04
0.05
0.06
0.07
Time Complexity Comparsion with QuickSort
QuickSort QuickSort + CutShort
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 210
0.01
0.02
0.03
0.04
0.05
0.06
0.07
Time Complexity Comparsion with MergeSort
MergeSort Merge + Cutshort
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 210
2
4
6
8
10
12
14
Time Complexity Comparsion with Insertion Sort
Insertion Sort Insertion + Cutshort
Thank You