| | |
Linked Lists
![]() |
•
•
•
•
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?
"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
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.
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.
![]() |
Similar Threads
- strcpy and linked lists (C++)
- Concordance, Linked Lists and classes (C++)
- help with linked lists (C++)
- Singly-Linked Lists: Ultimate (C++)
- Bug when creating linked lists in Dev C++ (C++)
- C/ Need Help with Linked Lists please (C)
- stack of linked lists (C++)
Other Threads in the C Forum
- Previous Thread: Switch Statement, Fall-Through.
- Next Thread: Dynamic Memory Allocation - offset pointers
| Thread Tools | Search this Thread |
* ansi api array arrays binarysearch calculate centimeter changingto char character convert copyanyfile copypdffile creafecopyofanytypeoffileinc createcopyoffile createprocess() csyntax directory dynamic fflush file floatingpointvalidation forloop frequency function getlasterror getlogicaldrivestrin givemetehcodez grade graphics gtkgcurlcompiling gtkwinlinux highest histogram homework i/o inches include infiniteloop input intmain() iso keyboard km linked linkedlist linux linuxsegmentationfault list logical_drives looping loopinsideloop. lowest match matrix microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pdf posix power program programming pyramidusingturboccodes radix read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprogramming stack standard strchr string suggestions test threads turboc unix urboc user variable whythiscodecausesegmentationfault win32api windows.h windowsapi






