Bifalgorithm post

Looking for one number in a big sorted list? Checking them one by one is slow. Binary search finds it in just a few steps. Watch. We want 23, jump to the middle. Too small, throw away the left half and go right. Too big, go left. Every guest cuts the list in half, so you zero in fast. In code, keep a low and a high pointer, check the middle and move the boundary you don't need. Run it. 23 sits at index 5, found in only a couple of checks. That's binary search. Sorted data only, but incredibly fast. Follow for more DSA in 60 seconds.

Looking for one number in a big sorted list? Checking them one by one is slow. Binary search finds it in just a few steps. Watch. We want 23, jump to the middl…

Ideas in this flowchart

  • Binary Search Overview
  • Problem Description
  • Search in Sorted List
  • Binary Search Process
  • Middle Element Check
  • Adjust Search Range
  • Implementation Details
  • Pointers: Low & High
  • Boundary Adjustment
  • Efficiency
  • Fast Search
  • Sorted Data Requirement
Feed/

Looking for one number in a big sorted list? Checking them one by one is slow. Binary search finds it in just a few steps. Watch. We want 23, jump to the middle. Too small, throw away the left half and go right. Too big, go left. Every guest cuts the list in half, so you zero in fast. In code, keep a low and a high pointer, check the middle and move the boundary you don't need. Run it. 23 sits at index 5, found in only a couple of checks. That's binary search. Sorted data only, but incredibly fast. Follow for more DSA in 60 seconds.

"Looking for one number in a big sorted list?"

👍
0
0 comments0 shares

Sign in to view and post comments.