|
||||||
| C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
In computer science, a "linked list" is one of the fundamental data structures, and can be used to implement other data structures.
__________________
Like an angel without a sense of mercy. |
|
|||||
|
A linked list can be used to manage a dynamically growing/shrinking list of data. It's primary advantage is for sorting: if each piece of "data" consists of a large data structure, you only have to adjust the links (usually a pointer) rather than copying the data. The biggest disadvantage is in searching through the data, as you have to traverse through all the items on the list preceding it.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
|
|||
|
Quote:
The type of data structure depends heavily on the use case. Say you want a dictionary but do not know the size of your data set before hand and cannot survive length pauses (making a hash table unsuitable because you cannot guarantee you won't need to rehash). You could use a self balancing tree which is less efficient in general but is more consistent than a hash table. Sometimes consistency is better than overall efficiency (i.e. the worst case often dominates rather than the average case, rehashing might be enough to spoil your day if it's a particularly large hash table). Generally any case where you don't know the size of your data set can utilise linked lists of some form. You can of course create growable arrays (which basically reallocate and copy the entire array each time it needs to grow) but as mentioned above this has issues if you don't want pauses on large data structures. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linked list | borny86 | Pascal/Delphi | 9 | 12-06-2007 12:42 PM |
| questions about linked lists | jkurth | Java Help | 0 | 11-10-2007 07:33 PM |
| Linked lists of strings (C) | Panserbjorn | C and C++ | 1 | 10-26-2007 05:58 PM |
| C basics. | justin1993 | C and C++ | 4 | 07-24-2007 08:56 AM |
| adding new nodes in a linked list while looping | emda321 | C and C++ | 2 | 06-18-2007 03:27 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |