Bubble Sort

This is going to be the first in a series of sorting algorithm posts. I thought I’d make these posts so I can quickly refresh my memory of the algorithms in the future.

Time Complexity: O(n²)

Bubble sort is simple to implement but inefficient. It passes along the all items in the set multiple times, switching adjacent values if they are out of order. Here is my implementation:

This entry was posted in programming and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.