Which of the following scenarios is a real-world application of binary search?

Practice Questions

Q1
Which of the following scenarios is a real-world application of binary search?
  1. Finding a name in a phone book
  2. Sorting a list of names
  3. Searching for a file in a directory
  4. Inserting an element in a linked list

Questions & Step-by-Step Solutions

Which of the following scenarios is a real-world application of binary search?
  • Step 1: Understand what binary search is. It is a method used to find an item in a sorted list by repeatedly dividing the search interval in half.
  • Step 2: Think about a phone book. A phone book is a list of names that is sorted alphabetically.
  • Step 3: When you want to find a name in the phone book, you can open it to the middle page to see if the name is there.
  • Step 4: If the name you are looking for comes before the middle name, you can ignore the second half of the book and only look in the first half.
  • Step 5: If the name comes after the middle name, you ignore the first half and only look in the second half.
  • Step 6: Repeat this process until you find the name or determine that it is not in the book.
No concepts available.
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely