@@ -32,13 +32,14 @@ $ pip install py-algorithms
32
32
- Max PQ
33
33
- Suffix Array
34
34
35
- ^ Search
35
+ ^ Search Algorithms
36
36
- Binary Search
37
37
38
- ^ Sorting
38
+ ^ Sort Algorithms
39
39
- Shell Sort (Shell method)
40
40
- Heap Sort (Fibonacci heap)
41
41
- Merge Sort
42
+ - Comb Sort
42
43
- Bubble Sort
43
44
- Selection Sort
44
45
@@ -98,6 +99,29 @@ sorting_algorithm(xs)
98
99
# => [-1, 0, 4, 5, 6, 7, 8, 9, 12]
99
100
```
100
101
102
+ #### * Comb Sort (https://en.wikipedia.org/wiki/Comb_sort)
103
+
104
+ Comb sort is a relatively simple sorting algorithm originally designed by
105
+ Włodzimierz Dobosiewicz in 1980. Later it was rediscovered by Stephen Lacey and Richard Box in 1991.
106
+ Comb sort improves on bubble sort. The basic idea is to eliminate turtles,
107
+ or small values near the end of the list, since in a bubble sort these slow the sorting down tremendously.
108
+ Rabbits, large values around the beginning of the list, do not pose a problem in bubble sort.
109
+
110
+ Worst case: О(n^2)
111
+ Best case: О(n log n)
112
+ Average: О(n^2)
113
+ Worst case space: O(1)
114
+
115
+ ``` python
116
+ from py_algorithms.sort import new_comb_sort
117
+
118
+ xs = [0 , 6 , 7 , 8 , 9 , 4 , 5 , 12 , - 1 ]
119
+ sorting_algorithm = new_comb_sort()
120
+ sorting_algorithm(xs)
121
+
122
+ # => [-1, 0, 4, 5, 6, 7, 8, 9, 12]
123
+ ```
124
+
101
125
#### * Selection Sort (https://en.wikipedia.org/wiki/Selection_sort)
102
126
103
127
In computer science, selection sort is a sorting algorithm,
0 commit comments