In the context of searching algorithms, why might a binary search be preferred over a linear search?

  • Binary search guarantees to find the target quickly
  • Binary search is always faster
  • Binary search requires sorted data
  • Binary search works for unsorted data
Binary search is preferred when data is sorted as it allows for efficient searching, while a linear search works for unsorted data.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *