0Pricing
C Academy · Lesson

Bubble and Insertion Sort

Simple sorts.

Simple Sorts

Bubble sort and insertion sort are the two simplest comparison sorts. Both are O(n squared) in the worst case but easy to understand and useful for small or nearly sorted arrays.

How Bubble Sort Works

Bubble sort repeatedly walks the array, swapping adjacent out-of-order pairs. After each full pass the largest remaining element bubbles to its final position at the end.

All lessons in this course

  1. Bubble and Insertion Sort
  2. Quicksort
  3. Mergesort
  4. Using qsort
← Back to C Academy