Comb Sort is mainly an improvement over Bubble Sort. Bubble sort always compares adjacent values. So all inversions are removed one by one. Comb Sort improves on Bubble Sort by using gap of size more than 1. The gap starts with a large value and shrinks by a factor of 1.3 in every iteration until it reaches the value 1. Thus Comb Sort removes more than one inversion counts with one swap and performs better than Bublle Sort.
The shrink factor has been empirically found to be 1.3 (by testing Combsort on over 200, 000 random lists) [Source: Wiki]
Although, it works better than Bubble Sort on average, worst case remains O(n2).
Sorted array: -44 -6 0 1 3 4 8 23 28 56
Please refer complete article on Comb Sort for more details!
- Java Program for Comb Sort
- Comb Sort
- Program to sort an array of strings using Selection Sort
- Java Program for Odd-Even Sort / Brick Sort
- C/C++ Program for Odd-Even Sort / Brick Sort
- C++ Program for Gnome Sort
- C Program for Bubble Sort
- C++ Program for Stooge Sort
- C++ Program for Bubble Sort
- C++ Program for Cocktail Sort
- C Program for Insertion Sort
- C++ Program for Pigeonhole Sort
- C Program for Counting Sort
- C++ Program for Heap Sort
- C++ Program for Bitonic Sort