Comb Sort
Definition:
Comb sort is an improvement over bubble sort. It compares elements that are farther apart initially, decreasing the gap between elements in subsequent iterations. The idea is to eliminate "turtles" (small values near the end of the list) early in the sorting process, which slows down bubble sort.
Video Explanation

Characteristics:
-
Gap Decrease:
- Comb sort starts by comparing elements that are far apart, reducing the gap by a shrinking factor (usually 1.3) after each pass until the gap becomes 1, at which point it behaves like bubble sort.
-
In-Place Sorting:
- Like bubble sort, comb sort is an in-place sorting algorithm, meaning it requires no extra memory aside from the input array.
-
Unstable:
- Comb sort is an unstable sorting algorithm, meaning that equal elements may not retain their relative order.
-
Improvement over Bubble Sort:
- By addressing "turtles" early, comb sort can improve upon the O(n²) performance of bubble sort, making it faster for larger datasets.