important quistion

[b]can we use binary search algorithm with sorted linked list? explain why???
Have you tried it?
no but i want to know if it is true or not
Do you know what a linked list is? Do you know what a binary search is? I'm confident that if you research these two terms, you'll be able to figure this one out.

I will give you a hint, in the form of a rhetorical question: how do you access element n in a linked list?
Last edited on
i think by pointing to the node of the element
Partially correct.
A linked list is basically a wrapper for a chain of nodes. Each node points to the next element and (I'm not sure if this is how it works in the STL) possibly to the one before it. To move through the list, the wrapper must examine each pointer to move down the elements until the desired element is found.
Anyway try googling your question first. That works in a lot of cases.
No, you can't. Binary search requires a random access structure.
Topic archived. No new replies allowed.