Which data structure is typically used for binary search?

  • Array
  • Linked List
  • Sorted Array
  • Stack
Binary search is typically performed on a sorted array. The reason for this is that binary search requires the elements to be in sorted order to efficiently divide and conquer the search space, reducing the time complexity to O(log n) compared to O(n) for linear search in an unsorted array.
Add your answer
Loading...

Leave a comment

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