Back to Exercise List

C# Bubble Sort

Question: Write a program in C# to sort numbers using bubble sort.

Explanation: In Bubble Sort, adjacent items are compared and they are swapped if they are not in sorted order. The time complexity of Bubble sort is O(n2).

Solution: