Lecture 5
Review of Big O Notation
1. Big O Notation Recap
o Big O notation is used to estimate the time (and space) efficiency of
algorithms, focusing on the worst-case scenario. It simplifies the
estimation by keeping only the fastest-growing term and discarding
all other details.
Sorting Algorithms Overview
1. Bubble Sort
o Complexity: O(n²)
o How It Works:
Repeatedly steps through the list.
Compares adjacent elements and swaps them if they are in
the wrong order.
Each pass through the list places the next largest element in
its correct position.
Example: