Explanation
- **Comb Sort** is a variation of **Bubble Sort** that improves on it by using a gap sequence. It eliminates small values near the end of the list more quickly by using a larger gap between comparisons.
-
Steps:
- Start with a large gap, typically about 1.3 times the size of the list.
- Compare elements that are
gappositions apart. - Reduce the gap after each pass and continue sorting.
-
Time Complexity:
- Best Case: O(n log n)
- Worst Case: O(n^2).