Found 3 Articles for Sorting Algorithm

Pigeonhole Sort

Sharon Christine
Updated on 15-Jun-2020 15:31:17

753 Views

This is an example of the non-comparison sorting technique. It is used where the number of items and the range of possible key values is approximately the same.To perform this sort, we need to make some holes. The number of holes needed is decided by the range of numbers. In each hole, items are inserted. Finally deleted from the hole and stored into an array for sorted order.The complexity of Pigeon-Hole Sort TechniqueTime Complexity: O(n+2^k)Space Complexity: O(2^k)Input and OutputInput: The unsorted list: 802 630 20 745 52 300 612 932 78 187 Output: Data before Sorting: 802 630 20 745 ... Read More

Cycle Sort

Sharon Christine
Updated on 15-Jun-2020 15:43:42

625 Views

Cycle Sort is an in-place sorting algorithm. It is also a comparison based sort and efficient for any other in-place sorting technique. It finds the minimum number of memory write to perform the sorting tasks.The complexity of Cycle Sort TechniqueTime Complexity: O(n^2)Space Complexity: O(1)Input and OutputInput: A list of unsorted data: 23 63 98 74 20 14 36 45 99 78 Output: Array before Sorting: 23 63 98 74 20 14 36 45 99 78 Array after Sorting: 14 20 23 36 45 63 74 78 98 99AlgorithmcycleSort(array, size)Input − An array of data, and the total number in the ... Read More

Comb Sort

Jai Janardhan
Updated on 15-Jun-2020 14:29:38

991 Views

The basic idea of comb sort and the bubble sort is same. In other words, comb sort is an improvement on the bubble sort. In the bubble sorting technique, the items are compared with the next item in each phase. But for the comb sort, the items are sorted in a specific gap. After completing each phase, the gap is decreased. The decreasing factor or the shrink factor for this sort is 1.3. It means that after completing each phase the gap is divided by 1.3.The complexity of Comb Sort TechniqueTime Complexity: O(n log n) for the best case. O(n^2/2^p) (p ... Read More

1
Advertisements