Which of the following statements about binary search is false?
Practice Questions
Q1
Which of the following statements about binary search is false?
It can be implemented recursively
It requires a sorted array
It can be used on linked lists
It is faster than linear search
Questions & Step-by-Step Solutions
Which of the following statements about binary search is false?
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: Know that binary search works best with data structures that allow random access, like arrays.
Step 3: Learn about linked lists. They store elements in nodes that are connected by pointers, and they do not allow random access.
Step 4: Realize that because linked lists do not have contiguous memory allocation, you cannot jump to the middle element quickly like you can in an array.
Step 5: Conclude that binary search is not efficient on linked lists because you have to traverse the list sequentially to find the middle element.