Re: binary search



JD wrote
(in article
<1122488288.786917.293670@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>):

> Given a sorted linked list it is required to perform a binary search
> for a particular element.

Then you will probably be better off storing the elements of the
list in a different data structure which lends itself to such
things.

> Kindly suggest an optimum algorithm for the
> problem.

arrays are commonly used for this. Binary search *is* the
algorithm.

More useful might be an AVL or other balanced tree solution for
real-world projects.

Is this homework? If it's a real world problem, describe what
you are actually trying to achieve.



--
Randy Howard (2reply remove FOOBAR)

.



Relevant Pages

  • Re: binary search
    ... Kindly suggest an optimum algorithm for the ... Binary search doesn't apply to linked lists. ... Prev by Date: ...
    (comp.programming)
  • Re: binary search
    ... Kindly suggest an optimum algorithm for the ... Binary search is not a practical solution for linked list. ... Prev by Date: ...
    (comp.programming)