Problem Solving

Concept shape

Core
0
1
2
3
4
5
Definition

Searching finds a target value or position in a collection.

Step 1 / 5
Concept shape
Current lesson

Searching Basics Lab

Problem Solving Core

Searching Basics

Welcome to the Searching Basics concept lab. Searching finds a target value or position in a collection. The must know points are: Linear search works anywhere. Binary search requires sorted or monotonic structure. Search can target an answer, not just an array value. The common operations are: scan, compare mid, move bounds. The complexity shape is Linear O(n), binary O(log n). Watch out for these pitfalls: Using binary search on unsorted data. Incorrect loop bounds. Related algorithms include Linear Search, Binary Search.

Concept details

Searching finds a target value or position in a collection.

Must know

  • Linear search works anywhere.
  • Binary search requires sorted or monotonic structure.
  • Search can target an answer, not just an array value.

Complexity

Linear O(n), binary O(log n)

Open deeper visual structure lesson
1.0x