Exponential search

hip-hop, educational

Listen on 93

Lyrics

[Verse 1]
Array spans a million slots, needle lost somewhere inside
Linear crawl would take forever, exponential's got that stride
Start with bound of one, then double, jump by powers of two
Leap past target, then backtrack with binary's rescue

[Chorus]
Expo-nential, find the range
Double bounds until they change
Over-shoot then binary
Log-squared time complexity
Jump and bound, then divide down
Fastest search when size's unknown

[Verse 2]
When the haystack's size is mystery, unbounded data stream
First we scout the territory, establish searching scheme
Index one, two, four, then eight, geometric progression
Once we overshoot the target, binary takes possession

[Chorus]
Expo-nential, find the range
Double bounds until they change
Over-shoot then binary
Log-squared time complexity
Jump and bound, then divide down
Fastest search when size's unknown

[Bridge]
Phase one: galloping ahead like digital cavalry
Phase two: binary precision cuts the space surgically
Outperforms linear by miles when data's truly vast
Two-stage rocket to the answer, logarithmic fast

[Verse 3]
Sorted infinite arrays where boundaries disappear
Expo search cuts through the void, makes the target clear
Memory access optimized, cache-friendly leaping stride
Better than naive approaches when the scale gets wide

[Outro]
Double up then narrow down
Expo search wears the crown
When you don't know where it ends
Logarithmic time transcends

← Interpolation search | Breadth-first search (BFS) →