Lesson 34 of 50
cSorting Algorithms – Bubble, Selection, Insertion
12 mins
Course progress68%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 34 of 50
c12 mins
Keep these ideas in mind as you work through the lesson.
Sorting puts data into a defined order. Below are three classic O(n²) algorithms, good for learning fundamentals.
Bubble Sort – repeatedly swap adjacent out‑of‑order elements. Selection Sort – repeatedly select the minimum element and place it at the front. Insertion Sort – build the sorted portion one element at a time.
All work on arrays and are stable (except selection, which can be made stable with extra work).