Link to home
Start Free TrialLog in
Avatar of Deepikakumar
Deepikakumar

asked on

indexing on linked list

Dear Experts,
   
     Can anyone please give me an idea on "indexing on a linked list".
The linked list would have the following description.

something like

struct list
{
  char* str;
  listdetails details;  // structure defined below
  list next;
}

struct listdetails
{
  char* serverip;
  int time;
  typespace adspace;    // another linked list defined below
}
struct typespace
{
  bool status;
  char* value;
  char* default value;
  typespace nextspace;
}


   there may be maximux of 20 elements in the list( it may increase later), hence while searching a particular element i dont want to do a string campare everytime that would not be an optimum code.
   is there is any way i could index the first linked list so that the lookup would be faster.
please get back to me at the earliest.
Regards
Deepika

Avatar of sarda_ramesh
sarda_ramesh

Hi Deepika,
  U can have a hashing function to convert the string to soem number and then u can use the number throughout.

regards
ramesh
Avatar of Deepikakumar

ASKER

Hi Ramesh,

  Thank you,  i actually thought about this idea but was thinking as to how to go about it. I have not done it before. Can you give me some inputs on hashing function please.

Regards
Deepika
ASKER CERTIFIED SOLUTION
Avatar of sarda_ramesh
sarda_ramesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
u can also check the following link..

http://www.maththinking.com/boat/computerbooks.html

or else u can refer to any bool on data and file structure for Hanshing functions.

regards
ramesh