2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,10 +1,28 @@
{{Sorting Algorithm}}
The '''Comb Sort''' is a variant of the [[Bubble Sort]]. Like the [[Shell sort]], the Comb Sort increases the gap used in comparisons and exchanges (dividing the gap by <math>(1-e^{-\varphi})^{-1} \approx 1.247330950103979</math> works best, but 1.3 may be more practical). Some implementations use the insertion sort once the gap is less than a certain amount. See the [[wp:Comb sort|article on Wikipedia]].
Variants:
*Combsort11 makes sure the gap ends in (11, 8, 6, 4, 3, 2, 1), which is significantly faster than the other two possible endings
*Combsort with different endings changes to a more efficient sort when the data is almost sorted (when the gap is small). Comb sort with a low gap isn't much better than the Bubble Sort.
;Task:
Implement a &nbsp; ''comb sort''.
The '''Comb Sort''' is a variant of the [[Bubble Sort]].
Like the [[Shell sort]], the Comb Sort increases the gap used in comparisons and exchanges.
Dividing the gap by &nbsp; <big><math>(1-e^{-\varphi})^{-1} \approx 1.247330950103979</math> </big> &nbsp; works best, but &nbsp; <big> 1.3</big> &nbsp; may be more practical.
Some implementations use the insertion sort once the gap is less than a certain amount.
;Also see:
* &nbsp; the Wikipedia article: &nbsp; [[wp:Comb sort|Comb sort]].
Variants:
* Combsort11 makes sure the gap ends in (11, 8, 6, 4, 3, 2, 1), which is significantly faster than the other two possible endings.
* Combsort with different endings changes to a more efficient sort when the data is almost sorted (when the gap is small). &nbsp; Comb sort with a low gap isn't much better than the Bubble Sort.
<br>
Pseudocode:
'''function''' combsort('''array''' input)
gap := input'''.size''' ''//initialize gap size''
@ -28,3 +46,4 @@ Pseudocode:
'''end loop'''
'''end loop'''
'''end function'''
<br><br>