mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
[Bug] gnome sort: reverted merge commit adding error (#559)
* Revert "Merge pull request #513 from tania-cmyk/master" This reverts commit5eebdedefc
, reversing changes made to53e92ebc05
. * formatting source-code for16110cd079
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
parent
294d29b584
commit
cdf8453db8
@ -6,9 +6,7 @@ void sort(int *numbers, int size)
|
||||
int pos = 0;
|
||||
while (pos < size)
|
||||
{
|
||||
if (pos == 0)
|
||||
pos = 1;
|
||||
if (numbers[pos] >= numbers[pos - 1] || pos == 0)
|
||||
if (numbers[pos] >= numbers[pos - 1])
|
||||
pos++;
|
||||
else
|
||||
{
|
||||
@ -16,6 +14,9 @@ void sort(int *numbers, int size)
|
||||
numbers[pos - 1] = numbers[pos];
|
||||
numbers[pos] = tmp;
|
||||
pos--;
|
||||
|
||||
if (pos == 0)
|
||||
pos = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user