Skip to content

Instantly share code, notes, and snippets.

@fnbk
Created September 17, 2022 18:23
Show Gist options
  • Save fnbk/688c845438368ccbc88ebe2538d9929d to your computer and use it in GitHub Desktop.
Save fnbk/688c845438368ccbc88ebe2538d9929d to your computer and use it in GitHub Desktop.
public static int[] BubbleSort(List<int> listInput)
{
for (int i = 0; i < listInput.Count; i++)
{
for (int j = 0; j < listInput.Count; j++)
{
if (listInput[i] < listInput[j])
{
var temp = listInput[i];
listInput[i] = listInput[j];
listInput[j] = temp;
}
}
}
return listInput.ToArray();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment