Research Article: SA Sorting: A Novel Sorting Technique For Large-Scale Data
Research Article: SA Sorting: A Novel Sorting Technique For Large-Scale Data
Research Article
SA Sorting: A Novel Sorting Technique for Large-Scale Data
1
Mohammad Shabaz and Ashok Kumar2
1
Apex Institute of Technology, Chandigarh University, S.A.S. Nagar, India
2
Chitkara University Institute of Engineering and Technology, Chitkara University, Rajpura, India
Copyright © 2019 Mohammad Shabaz and Ashok Kumar. This is an open access article distributed under the Creative Commons
Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is
properly cited.
Sorting is one of the operations on data structures used in a special situation. Sorting is defined as an arrangement of data or
records in a particular logical order. A number of algorithms are developed for sorting the data. The reason behind developing
these algorithms is to optimize the efficiency and complexity. The work on creating new sorting approaches is still going on. With
the rise in the generation of big data, the concept of big number comes into existence. To sort thousands of records either sorted or
unsorted, traditional sorting approaches can be used. In those cases, we can ignore the complexities as very minute difference
exists in their execution time. But in case the data are very large, where execution time or processed time of billion or trillion of
records is very large, we cannot ignore the complexity at this situation; therefore, an optimized sorting approach is required. Thus,
SA sorting is one of the approaches developed to check sorted big numbers as it works better on sorted numbers than quick sort
and many others. It can also be used to sort unsorted records as well.
sorting. It works well for both smaller and larger lists or ALGORITHM 7: Partition (A, S, T).
records, but in case if the list is sorted, some results are
sometimes obtained that we cannot even imagine. It is built
on the recursion phenomenon. The algorithm is given in the sorted list but also on the unsorted list. The algorithm is
Algorithms 6 and 7. given in Algorithm 8.
The partition function works as follows: From the algorithms, it is clearly seen that if the list is
sorted, no interchange of elements is done; hence, it executes
A[S] � Z //(Pivot)
linearly. Thus, for the best case, it is O(n), and for average
A[SU − 1] //value < Z and worst cases, it is O(n2 ).
A[U + 1L − 1] //value ≥ Z
A[L . . . T] //unknown values 2.8. Counting Sort. It is a stable and easily understandable
Complexity analysis: sorting algorithm. As the name depicts, counting sort works
by finding the largest element in the given list/record, and
Let m : size and m � 2n then starting from the least element/number, its frequency is
Comparisons � m + 2 ∗ (m/2) m ∗ (m/m) counted and at last the sorted list is produced maintaining
m + m + m (n term) the order of its occurrence while sorting. It is useful in those
cases where the difference between the numbers is very small
O (nm) and the dataset is also very small. The step-by-step procedure
If n � m, then it is the worst-case scenario and of counting sort is discussed in Algorithm 9.
complexity � O(m2 ). But for the average- or best-case sce-
nario, n � log2 m and then complexity would be 2.9. Grouping Comparison Sort (GCS). Suleiman with his
O(m log2 m). team of three other members proposed the GCS algorithm.
The methodology they have used is to divide the given list/
record into groups. Each of these groups contains three
2.6. Tree Sort. It is an unstable sorting algorithm built on the
elements, and comparison is done in such a way that every
binary search tree (BST). The element in tree sort is sorted
element of one group is compared to that in other groups.
using in-order traversing operation. Tree sort requires extra
The main drawback of this algorithm is that the input size
memory space, and complexity changes from balanced BST
must be less than or equal to 25000 records to get the better
to unbalanced BST. The complexity of the tree sort is O(n2 )
results. The complexity becomes O(n2 ) for all the three cases.
for the worst case and O(n log n) for average and best cases.
(1) X⟵1
Head end Tail end (2) while x < m do
(3) x⟵3∗x + 1
Figure 1: Working of cocktail sort.
(4) end while
(5) while x > 0 do
(6) x ⟵ h/3
for the worst case, it remains the same as O(n2 ). For the best (7) end while
case, it is O(n) as no swap is done. (8) for (i � 1 : x) do
(9) InsertionI[i : x : m] ⟶ invariant : x − sublistissorted
(10) end for
2.14. Enhanced Selection Sort. It is the extended version of
selection sort which is made stable by decreasing the regular ALGORITHM 13: Shell sort.
size of the list. This is done in such a way that first the biggest
element is found, a swap is made, the size of the list is de-
creased by 1, and then the sort is again performed in a similar
way to get the list sorted. Although the complexity would be (1) Y[0....a − 1]
the same as that of selection sort but in the best-case scenario, (2) a ⟵ X.len
the number of swaps would be zero for enhanced selection (3) for (k � 0 to a − 1) do
sort. The complexity for all the three cases would be O(n2 ). (4) B[k] � Empty
(5) end for
(6) for(k � 0 to a) do
2.15. Shell Sort. It is the unstable and efficient sorting al- (7) putX[k]intoY[aX[k]]
gorithm which is the extended version of insertion sort. Shell (8) end for
(9) for (k � 0 to a − 1) do
sort works well if the given list is partially sorted. This means
(10) SortY[k]usinginsertionsorttechnique
we are discussing about the average-case scenario. Shell sort (11) end for
uses Knuth’s formula to calculate the interval or spacing. (12) joinY[0], Y[1] . . . .Y[a − 1]
This formula is given as follows: (13) while x > 0 do
(14) x ⟵ h/3
x � x ∗ 3 + 1, (6) (15) end while
where x has the starting value 1 and is called the interval/
spacing. Shell sort divides the given list into sublists by using ALGORITHM 14: Bucket sort ().
an increment which is called the gap, compares the elements,
and then interchanges them depending upon the order ei-
ther increasing or decreasing. The algorithm for shell sort is sorting techniques are used. The complexity for best, av-
given in Algorithm 13. erage, and worst cases is O(n log n).
For best and worst cases, the complexity is O(n log n)
and O(n2 ), respectively. For the average case, it depends
upon the gap. 2.18. Even-Odd/Brick Sort. It is another extension of bubble
sort, in which the BS algorithm is partitioned into two parts:
even part and odd part. Even part consists of even numbers,
2.16. Bucket Sort. It is a stable sort and consists of bucket. and odd part consists of odd numbers. Both the parts are
The elements are inserted in the bucket, and then, the sorting executed one by one, and at last, the combined result is
is employed on the bucket. Bucket sort does not have obtained and the records are sorted. It is a stable algorithm
comparisons and uses the index to sort. These indexes are with the same complexity as the bubble sort:
not just obtained from any mathematical function but are
obtained in such a way that they could satisfy the order of best case ⟶ O(n),
arrangement of numbers inserted in the bucket. The pro- worst case ⟶ On2 , (7)
cedure is explained in Algorithm 14.
2
The complexity for bucket sort would be O(n) for all the average case ⟶ On .
three cases.
2.17. Tim Sort. It is a combination of insertion and merge 2.19. Bitonic Sort. It is introduced through the concept of
sort. It is a stable and efficient sorting technique in which the merge sort. In bitonic sort, we move the list to level L − 1 with
list or record is split into blocks called “run.” If the size of list two parts: left part and right part; the left part is settled in an
or record is less than run, then it can be sorted using in- increasing order, and the right part is settled in a decreasing
sertion sort. The maximum size of the run would be 64 order [2]. These parts are merged, moved to level L, and then
depending upon the list or record. But if the size of the sorted to form the sorted sequence. The complexity for bitonic
unsorted list is very large, then both insertion and merge sort is O(n2 ) on best, worst, and average cases.
6 Journal of Computer Networks and Communications
Rotating Advances in
Machinery Multimedia
The Scientific
Engineering
Journal of
Journal of
Hindawi
World Journal
Hindawi Publishing Corporation Hindawi
Sensors
Hindawi Hindawi
www.hindawi.com Volume 2018 http://www.hindawi.com
www.hindawi.com Volume 2018
2013 www.hindawi.com Volume 2018 www.hindawi.com Volume 2018 www.hindawi.com Volume 2018
Journal of
Control Science
and Engineering
Advances in
Civil Engineering
Hindawi Hindawi
www.hindawi.com Volume 2018 www.hindawi.com Volume 2018
Journal of
Journal of Electrical and Computer
Robotics
Hindawi
Engineering
Hindawi
www.hindawi.com Volume 2018 www.hindawi.com Volume 2018
VLSI Design
Advances in
OptoElectronics
International Journal of
International Journal of
Modelling &
Simulation
Aerospace
Hindawi Volume 2018
Navigation and
Observation
Hindawi
www.hindawi.com Volume 2018
in Engineering
Hindawi
www.hindawi.com Volume 2018
Engineering
Hindawi
www.hindawi.com Volume 2018
Hindawi
www.hindawi.com www.hindawi.com Volume 2018
International Journal of
International Journal of Antennas and Active and Passive Advances in
Chemical Engineering Propagation Electronic Components Shock and Vibration Acoustics and Vibration
Hindawi Hindawi Hindawi Hindawi Hindawi
www.hindawi.com Volume 2018 www.hindawi.com Volume 2018 www.hindawi.com Volume 2018 www.hindawi.com Volume 2018 www.hindawi.com Volume 2018