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?

Recommended Answers

All 2 Replies

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.