Skip to content

Commit

Permalink
comb_sort: fix typo and indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvins committed Oct 2, 2018
1 parent 5fb6b31 commit f4a80fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sorts/comb_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Comb sort is a relatively simple sorting algorithm originally designed by Wlodzimierz Dobosiewicz in 1980.
Later it was rediscovered by Stephen Lacey and Richard Box in 1991. Comb sort improves on bubble sort.
This is pure python implementation of counting sort algorithm
This is pure python implementation of comb sort algorithm
For doctests run following command:
python -m doctest -v comb_sort.py
or
Expand Down Expand Up @@ -31,15 +31,15 @@ def comb_sort(data):
i = 0

while gap > 1 or swapped:
# Update the gap value for a next comb
# Update the gap value for a next comb
gap = int(float(gap) / shrink_factor)

swapped = False
i = 0

while gap + i < len(data):
if data[i] > data[i+gap]:
# Swap values
# Swap values
data[i], data[i+gap] = data[i+gap], data[i]
swapped = True
i += 1
Expand Down

0 comments on commit f4a80fb

Please sign in to comment.