Algorithms and Data Structures · Junior · Question 39 of 75

How does bubble sort work?

Explanation

After each pass the largest remaining element "bubbles" to the end. It's O(n²) and is mainly used for teaching. Splitting and merging is merge sort; partitioning around a pivot is quicksort.

Further reading

Problem with a question

Algorithms and Data Structures · Junior · question 39

Test yourself

Take the Algorithms and Data Structures · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz