Can anyone give me some urls to good linked list tutorials? The one here is good, but doesn't even go as far as to cover doubly linked lists.
Thanks,
Valar_King
Can anyone give me some urls to good linked list tutorials? The one here is good, but doesn't even go as far as to cover doubly linked lists.
Thanks,
Valar_King
-Save the whales. Collect the whole set.
For doubly linked lists, I suggest linking 2 together at the highest point, and then using pointers to access anything from the second list.
_______________________
Sean Mackrory
[email protected]
This code is incomplete. Work in progress...
Those are the some basic building blocks.Code:typedef struct tagNode { struct tagNode *prev; char *data; long int ID; struct tagNode *next; }NODE; NODE *NewNode() { NODE *p; p = (NODE *)malloc(sizeof(NODE )); p -> next = NULL; p-> prev = NULL; return p; } void AddNode(NODE *p, NODE *head) { NODE *a; if(head == NULL) { head = p; return; } for(a = head; a->next != NULL; a = a->next) ; a->next = p; } void DeleteNode(NODE *p, NODE *head) { NODE *a; if(p == head) { head = p->next; free(p); return; } for(a = head; (a != NULL) && (a->next != p); a = a->next) ; a->next = a->next->next; free(p); }
Port to C++ as desired
heck, i can already make an app that lets you go forward and backward in a list of numbers, and delete and insert nodes. now that i've done doubly linked lists, i'd like to move on to more advanced things about it.
-Save the whales. Collect the whole set.