Data Structures and Algorithms: Why Faster Computers Can't Save Bad Algorithms
How the way you organize data decides what is fast: Big-O, hash tables, trees, heaps, sorting, graphs, dynamic programming and greedy choices.
Data Structures and Algorithms · 50 questions
Try 3 questions
1. An O(n²) algorithm moves to a computer 1,000 times faster. In the same time, how much larger an input can it handle?
- About 100 times larger
- About 1,000 times larger
- About 32 times larger
Show the answer
Answer: About 32 times larger
Time grows with n squared, so a 1,000-fold speedup only buys the square root of 1,000, roughly 32 times more input.
2. Doubling the input size of an O(n log n) algorithm roughly does what to its running time?
- Exactly doubles it, no more
- Roughly quadruples it
- A bit more than doubles it
Show the answer
Answer: A bit more than doubles it
n doubles and log n grows by just one step, so the time rises slightly more than twofold, far gentler than quadratic growth.
3. What does Big-O notation deliberately ignore?
- Constant factors and smaller terms
- How the time grows with input size
- How the algorithm behaves at worst
Show the answer
Answer: Constant factors and smaller terms
Big-O describes the growth rate for large inputs, so 3n² + 100n and n² are both O(n²).
The whole quiz comes before your apps
BrainTok asks a few questions like these before the apps you choose open, so your screen time turns into learning. For iPhone.
Join the beta