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.
>
> Unfortunately l am not give a choice as the data structure that l am able to
> work with. Therefore any help would be greatly appreciated
Then you simply have to scan the list for each insertion.
Also, the above ListNode structure doesn't make sense. It would also
need to contain a count of how many items are stored in the array.
--
Glynn Clements <[EMAIL PROTECTED]>