Sorting algorithms/Gnome sort: Difference between revisions

Content added Content deleted
m (added a ;Task (bold) section header, added whitespace before the TOC.)
Line 2: Line 2:
{{Sorting Algorithm}}
{{Sorting Algorithm}}
{{Wikipedia|Gnome sort}}
{{Wikipedia|Gnome sort}}


Gnome sort is a sorting algorithm which is similar to [[Insertion sort]], except that moving an element to its proper place is accomplished by a series of swaps, as in [[Bubble Sort]].
Gnome sort is a sorting algorithm which is similar to [[Insertion sort]], except that moving an element to its proper place is accomplished by a series of swaps, as in [[Bubble Sort]].


Line 23: Line 25:
'''done'''
'''done'''



'''Task''': implement the Gnome sort in your language to sort an array (or list) of numbers.
;Task:
Implement the Gnome sort in your language to sort an array (or list) of numbers.
<br><br>

=={{header|ActionScript}}==
=={{header|ActionScript}}==
<lang ActionScript>function gnomeSort(array:Array)
<lang ActionScript>function gnomeSort(array:Array)