GATE CSE
First time here? Checkout the FAQ!
x
0 votes
110 views
Why linked list not suitable for binary search?
asked in DS by (25 points)   | 110 views

2 Answers

+1 vote
Best answer
There is no way to index the elements in the linked list which makes it unsuitable for binary search.
answered by Junior (593 points)  
selected by
We use binary search to reduce the search complexity to $O(\log n)$ but in a linked list to find the middle element itself takes $O(n)$.
Thanku
0 votes
Because nodes of linked list may or may not be present in the continuous memory location, so we can only use linear search while array occupies continuous memory location, so a binary search is possible.
answered by (17 points)  
Top Users Feb 2017
  1. Arjun

    5386 Points

  2. Bikram

    4230 Points

  3. Habibkhan

    3952 Points

  4. Aboveallplayer

    3086 Points

  5. Debashish Deka

    2564 Points

  6. sriv_shubham

    2318 Points

  7. Smriti012

    2240 Points

  8. Arnabi

    2008 Points

  9. mcjoshi

    1696 Points

  10. sh!va

    1684 Points

Monthly Topper: Rs. 500 gift card

20,863 questions
26,022 answers
59,696 comments
22,133 users