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

    7172 Points

  2. Habibkhan

    4696 Points

  3. Vijay Thakur

    4308 Points

  4. sudsho

    4090 Points

  5. saurabh rai

    4024 Points

  6. Arjun

    3292 Points

  7. santhoshdevulapally

    3066 Points

  8. GateSet

    3016 Points

  9. Bikram

    3014 Points

  10. Sushant Gokhale

    2892 Points

Monthly Topper: Rs. 500 gift card

18,838 questions
23,808 answers
51,589 comments
20,148 users