Lesson 34 of 50 · c
Sorting Algorithms – Bubble, Selection, Insertion
Duration: 12 mins
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).