954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Linked Lists

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?

mariners95
Newbie Poster
2 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

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?

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

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.

Tight_Coder_Ex
Posting Whiz in Training
215 posts since Feb 2005
Reputation Points: 47
Solved Threads: 17
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You