Can Binary Search be used for linked lists?

Binary search is a type of search that can be used to find a target value within a sorted array. In a linked list, random access is typically not allows, which makes it difficult to reach the middle element in O(1) time. As Binary Search searches in O(1) time, it cannot be used for linked lists. However, there are other ways to search a linked list, such as linear search.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.