Jaconir
Skip to lesson
medium
30 minIntern through senior

When to use. Sorted data or a monotonic predicate → binary search. Unweighted shortest path / levels → BFS. Explore all → DFS.

Complexity. Time Binary search O(log n); BFS/DFS O(V + E). Space Binary search O(1); BFS O(width); DFS O(depth).

Who gets asked. Classic binary search is intern. Searching on a predicate (“first true”) and grid BFS are mid-level.

Prereq. Arrays for binary search; queues/stacks for BFS/DFS.

Searching Algorithms

Master the fundamental algorithms for finding data, from the efficient Binary Search to graph traversals like BFS and DFS.

Finding Needles in Haystacks

Searching is one of the most common tasks in programming. Imagine looking for a contact in your phone or a file on your computer. Behind the scenes, a searching algorithm is at work. A simple approach is **Linear Search** (checking every single item), but that's slow for big lists. We'll explore smarter, faster ways.

Classic binary search on a sorted array is intern-level and O(log n). The 2026 follow-up is binary search on a predicate: find the first index where a monotonic condition becomes true (minimum capacity, first bad version). BFS is unweighted shortest path / level order — intern/mid on grids. DFS explores; it is not shortest path on unweighted graphs. Weighted graphs belong on the graphs lesson (heap + Dijkstra).

Binary Search Visualizer
Binary Search is a super-fast way to find an item in a **sorted** list. Imagine finding a word in a dictionary: you open to the middle, see if your word is before or after, and then you only have to search one half. Binary Search does the same thing, cutting the search area in half with every step.
2
5
8
12
16
23
38
56
72
91
Enter a target value and click "Start Search".
Graph Traversal (BFS vs. DFS)
Compare how Breadth-First Search (**BFS**) explores neighbors level-by-level (like ripples in a pond), while Depth-First Search (**DFS**) goes as deep as it can down one path before backtracking.
ABCDEFGH
Select an algorithm and click "Start".
[]
[]
Interview Problems
Learn how to apply searching concepts to solve common interview questions.
1357
10111620
23303460
Start. Treat the 2D matrix as a flat, sorted array of size 12. Left=0, Right=11.
Coding Challenge
A strictly increasing list that was rotated at an unknown index. Return the target’s index or -1. Modified binary search: each step one half is sorted. O(log n).
Quick Quiz: Test Your Knowledge

Which data structure is used to implement Breadth-First Search (BFS)?

Binary search can only be performed on which type of data structure?

Which graph traversal algorithm is more suitable for finding the shortest path between two nodes in an unweighted graph?

J
Dafin Edison J
Creator & Developer of Jaconir

I build things for the web. From immersive games to practical tools, my goal is to create products that people love to use and to share the knowledge I've gained along the way.

Saved in this browser. No account.