Peter wrote:

I am looking for a data structure that I need to use as follows.

Suppose I am looking for node A. When I perform a lookup for node A I

also want information about the node previous to node A( as per the

lookup data structure ordering scheme). Is there anything that I could

use for this. Using a doubly linked list is not looking good as I can

have a large number of elements in my linked list.

If there's a C question here, I'm failing to see it.

Well, maybe there is: If "previous" is a relation defined

by a key value in the node, you can maintain the collection

of nodes as a sorted array and look things up with bsearch().

Other algorithms certainly exist, and may be more

appropriate (you really haven't explained your problem in

any detail) -- but this is a language newsgroup, not an

algorithms newsgroup. Once you've settled on an approach,

come back here for help if you're having trouble implementing

it in C.

--

Er*********@sun.com