Linked Lists

Reply

Join Date: Feb 2005
Posts: 2
Reputation: mariners95 is an unknown quantity at this point 
Solved Threads: 0
mariners95 mariners95 is offline Offline
Newbie Poster

Linked Lists

 
0
  #1
Feb 23rd, 2005
Could someone help me with a linked list code.

I just cant figure it out.

I dont know how to code the part where I need to insert an element in ascending order.

Either when there are no nodes then when there is one or a few nodes.

Can anyone give a little nudge in the right direction?
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,334
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 234
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Linked Lists

 
0
  #2
Feb 24th, 2005
Originally Posted by mariners95
Could someone help me with a linked list code.

I just cant figure it out.

I dont know how to code the part where I need to insert an element in ascending order.

Either when there are no nodes then when there is one or a few nodes.

Can anyone give a little nudge in the right direction?
I used to read minds and peruse your computer for entertainment, but I've since lost this ability. Would you mind posting any code that you are wondering about?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 199
Reputation: Tight_Coder_Ex is an unknown quantity at this point 
Solved Threads: 14
Tight_Coder_Ex's Avatar
Tight_Coder_Ex Tight_Coder_Ex is offline Offline
Junior Poster

Re: Linked Lists

 
0
  #3
Feb 24th, 2005
Linked lists are very simple. Take for example a doubly linked list, it has a pointer to the previous item and one to the next. I use -1 or 0xffffffff to indicate the item is either at the begining or end of the list. Each time you insert a new element you just change the pointers so they keep the list ordered.

As Dave Sinkula has eluded too, post some code so whomever helps you has some idea where to start. Google "linked lists" and I'm sure you'll get lots of detailed information on how a list works, not necessarily associated code but there may be some breif examples.
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC