//The data structure.
//*****************************
struct data
{
char field1 [256];
char field2 [256];
char field3 [256];
struct data *nextptr;
struct txtline *firstline1;
};
//these are aliases for the structure.
typedef struct data DATA;
typedef DATA *DATAPTR;
//*****************************
//*****************************
struct txtline
{
char textline [256];
struct txtline *nextptr;
};
//these are aliases for the buffer structure.
typedef struct txtline TXT;
typedef TXT *TXTPTR;
//*****************************
in this example I have two structures in the data structure.
the first is a structure of the same type. Look into linked lists. the second structure is of the second type.
this is a linked list inside of the first linked list.
Hi,
The example butthead gave is the data structure called "hash table". Each node of the link list is an entry into hash table and is the head node for another list. So, if you imagine, it would be a table with list hanging out at every node of table.
Hey,
The only difference between actual hash table implementation and this is of hash key. Hash key is index (similar to index in array) which can be either some unique values or values generated using hash function. And, the value linked to that index can be either some integer, structure, or head node of link list.
So, I wanted to give just a rough picture of hash table to those, who are new to data structure. Hope, I din't confused you guys
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.