Answer the question
In order to leave comments, you need to log in
Sorting does not work correctly. where is the mistake?
there is such a sorting
array 1256, 4558, 221, 665, 789, 23 comes into it
and it comes out like this 789, 665, 4558, 23, 221, 1256
and as I understand it sorts by the first digit 7, 6, 4, etc .d.
class InsertionSorting
{
public string[] SortUp(string[] lane)
{
string temp;
int j;
for (int i = 1; i <= lane.Length - 1; i++)
{
temp = lane[i];
j = i - 1;
while (j >= 0 && String.CompareOrdinal(lane[j], temp) < 0)
{
lane[j + 1] = lane[j];
j--;
}
lane[j + 1] = temp;
}
return lane;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question