>RunTimeFix
BookStudyPracticeInterviewsYouTubeCoursesAbout
Log inGet Started
Topics/Binary Search
beginner level

Binary Search

Quick Answer

What is Binary Search?

Binary search is one of the most powerful and frequently misimplemented algorithms. The core idea is simple: if a monotonic condition divides your search space into two halves, you can find the boundary in O(log n) instead of O(n). RunTimeFix teaches two forms: binary search on sorted arrays (finding elements, lower_bound, upper_bound) and binary search on the answer (checking feasibility of a candidate answer with a monotonic predicate). We drill boundary handling — the source of most binary search bugs — until it becomes second nature.

  • binary search
  • lower bound
  • upper bound
  • binary search on answer
  • parametric search
  • O(log n)

Study Material for Binary Search

Ch 15: Binary Search (Array & Answer Space)

Binary Search on a Sorted Array · STL Binary Search Functions · Binary Search on the Answer · Boundary Handling

Ch 10: Sorting & Frequency Arrays

std::sort — The Workhorse · lower_bound & upper_bound — Binary Search in STL · binary_search — Boolean Existence Check · unique — Removing Consecutive Duplicates · next_permutation — Generating Permutations · Sorting Applications · Frequency Counting

Related Topics

AlgorithmsCompetitive ProgrammingTwo Pointers & Sliding Window
Was this helpful?

Published by RunTimeFix · Comprehensive guides for competitive programming

>RunTimeFix

Practical programming education. Books, videos, courses, and hands-on learning for competitive programming, DSA, and software engineering.

RunTimeFix

  • About
  • YouTube
  • Book
  • Study Library
  • Courses

Learn

  • Competitive Programming
  • DSA
  • Development
  • Databases

Legal

  • Privacy
  • Terms
  • Refund Policy

RunTimeFix — debug → solve → run

© 2026 RunTimeFix. All rights reserved.