Lesson 1 of 3Module 1 · 0% of course
‹ PrevNext ›
Data Structures & Algorithms · Complexity

Big-O: how code scales

Why matching 1M trades with a nested loop takes hours, and with a dict takes a second.

15 min · 5 steps · videoJump to quiz ↓
1. Algorithms and Computation MIT OpenCourseWare · 46 min
Open in YouTube
Step 1 of 5 · 1. Growth rates15 min read ·

1. Growth rates

Big-ONameExample1M items ≈ steps
O(1)constantdict lookup1
O(log n)logarithmicbinary search20
O(n)linearscan a list1,000,000
O(n log n)linearithmicsort20,000,000
O(n²)quadraticnested loop match1,000,000,000,000
Next: 2. The recon example
‹ PrevNext ›