944,191 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 3210
  • C RSS
Feb 23rd, 2005
0

Linked Lists

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mariners95 is offline Offline
2 posts
since Feb 2005
Feb 24th, 2005
0

Re: Linked Lists

Quote 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?
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Feb 24th, 2005
0

Re: Linked Lists

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.
Reputation Points: 47
Solved Threads: 17
Posting Whiz in Training
Tight_Coder_Ex is offline Offline
215 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Switch Statement, Fall-Through.
Next Thread in C Forum Timeline: GetKeyState syntax





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC