GATE CSE
First time here? Checkout the FAQ!
x
0 votes
122 views
Why linked list not suitable for binary search?
asked in DS by (25 points)   | 122 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 Mar 2017
  1. rude

    5236 Points

  2. sh!va

    3054 Points

  3. Rahul Jain25

    2920 Points

  4. Kapil

    2732 Points

  5. Debashish Deka

    2602 Points

  6. 2018

    1574 Points

  7. Vignesh Sekar

    1430 Points

  8. Bikram

    1424 Points

  9. Akriti sood

    1420 Points

  10. Sanjay Sharma

    1128 Points

Monthly Topper: Rs. 500 gift card

21,549 questions
26,889 answers
61,247 comments
23,251 users