Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. Here is an example of how to implement bubble sort in C#:
main.cs369 chars17 lines
To use the above function to sort an array, you can simply call it like this:
main.cs114 chars8 lines
This will output: 1 2 3 5 7 8 9
gistlibby LogSnag