Renato wrote:

> l am wanting to implement an ordered linked list of blocks
> the declaration that l am using is

> #define BLOCKSIZE 100
> typdef struct listNode *listNodePtr;
> 
> typdef struct data{
>     char *key;
>     chat *value;
>  }Data;
> 
> typdef stuct listNode{
>     Data ListNodeData[BLOCKSIZE];
>     listNodePtr next;
> }ListNode;
> 
> typdef struct list{
>     listNodePtr head;
>     unsigned listSize;
>     unsigned extract;
> }List;
> 
> l use the extract field to keep the index value last array position in the
> current node.
> My question is could l please recieve some help implementing the entry of
> data into this struture for both key and value in an ordered format.

Linked lists aren't a particularly suitable structure for sorted data, 
as the insertion time is proportional to the number of entries.

Better solutions would be binary or n-ary trees, or a two-level array
(an array of pointers to blocks). All of these have logarithmic time
complexity. The algorithms should be available in any text book.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to