A linked list is a data structure that consists of a group of nodes that together represent a sequence.

Each node is composed of a generic data element and a reference to the next node in the sequence.

- Arrays can be traversed randomly, while linked lists must be traversed sequentially.
- Linked list can grow dynamically, while arrays must define a size before its instantiation.
- Because arrays have fixed sizes, we must know the upper limit of the number of elements in advance.
- Memory allocation for an array is compile time and linked list is run time.
- Inserting elements into an array is expensive since we have to shift all elements coming after the insertion node over one. For linked lists, however, you can simply insert a node by reconfiguring the node coming before it.
- Linked lists allow for dynamic resizing, making it easy to add more data.

There are several types of linked lists, but we'll begin by looking at the simplest - the singly-linked list.

A singly-linked list has only a NEXT pointer, which points to the next node in sequence. A doubly-linked list would have an additional PREV pointer that points to the previous node.

There is also a circular linked list, in which one next NEXT pointer points to a previous element.

The linking of a group of NODE objects is what gives us a linked list. Each NEXT pointer connects one node to the next. If the node is at the end, its NEXT pointer will point to NULL.

Additionally, there are two more pointers in a linked list. The HEAD of the linked list holds the first node in the list, while the TAIL holds the last.

Operation | Average | Worst |

Space | O(n) | O(n) |

Lookup | O(n) | O(n) |

Insert | O(n) | O(n) |

Delete | O(n) | O(n) |

Algorithms are the procedures that software programs use to manipulate data structures. Besides clear and simple example programs, the author includes a workshop as a small demonstration program executable on a Web browser. The programs demonstrate in graphical form what data structures look like and how they operate.

$ Check price(97+ reviews)

Ever feel achy from sitting crunched up on your computer table? Try lying down with these optical glasses that allow you to work on your laptop while lying flat on your back. This is the perfect solution with those with limited mobility or those who wish to prevent neck cramps and back strains.

$ Check price(128+ reviews)

Ad