Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
public static void gnomeSort(int[] anArray)
|
||||
{
|
||||
int first = 1;
|
||||
int second = 2;
|
||||
|
||||
while (first < anArray.Length)
|
||||
{
|
||||
if (anArray[first - 1] <= anArray[first])
|
||||
{
|
||||
first = second;
|
||||
second++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int tmp = anArray[first - 1];
|
||||
anArray[first - 1] = anArray[first];
|
||||
anArray[first] = tmp;
|
||||
first -= 1;
|
||||
if (first == 0)
|
||||
{
|
||||
first = 1;
|
||||
second = 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue