linked list question

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2005
Posts: 244
Reputation: Drowzee is an unknown quantity at this point 
Solved Threads: 5
Drowzee Drowzee is offline Offline
Posting Whiz in Training

Re: linked list question

 
0
  #11
Apr 7th, 2006
I'm fairly confident with making/destroying linked lists (one of my few strengths compared to other inexperienced coders), but I see what you mean.

For the first node you'd certainly use a method of creating the head node pointer then linking it to the first node, but after that, you can use a temporary pointer to point to the new nodes and link if you're wanting to perform an insertion rather than an append. For supporting inserts, that's actually a bit clearer. Otherwise, you would create pointers to nodes before and after the insert point to keep track of the rest of the list while you added nodes, which is trivially more expensive in terms of memory.
Explainer of control logic and some basics.
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2634 | Replies: 10
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC