Sorting Algorithms/Circle Sort: Difference between revisions

m
added whitespace before the TOC, added a ;See also: (bold) header, added other whitespace in the task's preamble.
m (added whitespace before the TOC, added a ;See also: (bold) header, added other whitespace in the task's preamble.)
Line 1:
{{draft task|Sorting Algorithms}}{{Sorting Algorithm}}
 
Sort an array of integers (of any convenient size) into ascending order using Circlesort. In short, compare the first element to the last element, then the second element to the second last element, etc. Then split the array in two and recurse until there is only one single element in the array, like this:
Sort an array of integers (of any convenient size) into ascending order using Circlesort.
 
In short, compare the first element to the last element, then the second element to the second last element, etc.
 
Then split the array in two and recurse until there is only one single element in the array, like this:
Before:
'''6''' ''7'' 8 9 2 5 3 ''4'' '''1'''
Line 39 ⟶ 44:
'''while''' circlesort (0, '''sizeof'''(array)-1, 0)
 
 
For more information on Circle sorting, see [http://sourceforge.net/p/forth-4th/wiki/Circle%20sort/ Sourceforge].
;See also:
__FORCETOC__
* For more information on Circle sorting, see [http://sourceforge.net/p/forth-4th/wiki/Circle%20sort/ Sourceforge].
<br><br>
 
=={{header|C}}==