Searching Algorithms: Binary and Linear Search
Binary search is the algorithm most engineers believe they know and most implement incorrectly under pressure. The idea takes a sentence; the boundary conditions are where interviews are actually lost.
Stepping through the search space narrowing makes the invariant visible, which is what makes the boundary decisions derivable rather than memorised. That matters because binary search rarely appears in interviews as "search this sorted array" — it appears disguised, applied to an answer space rather than an input array, and recognising it depends on understanding the invariant rather than the template.
2
Interactive lessons1
Free to open4
Languages (JS, Python, Java, C++)Searching lessons
Continue the DSA curriculum
Searching is one of 12 topics in the interactive DSA visualizer curriculum. Once this topic is comfortable, the coding interview pattern library reorganises the same material around the patterns interview questions are built on.
Every other DSA visualizer
Data Structures · 28 lessons
- StackFree
- QueueFree
- Deque
- Circular Queue
- Priority Queue (ADT)
- Tree Traversal
- Binary Tree
- Binary Search Tree
- AVL Tree
- Trie (Prefix Tree)
- Segment Tree
- Fenwick Tree
- Red-Black Tree
- Singly Linked List
- Doubly Linked List
- Circular Linked List
- Graph RepresentationFree
- Breadth/Depth First SearchFree
- Depth First Search
- Topological Sort
- Cycle Detection
- Connected Components
- Bipartite Graph
- Dijkstra's Algorithm
- Bellman-Ford Algorithm
- Minimum Spanning Tree
- Floyd-Warshall Algorithm
- Bridges & Articulation Points
