Sign InCoursewareNuggetsTutorials AboutClassesCodePad

What is a Linked List?

Like an array, a linked list also stores sequence of data elements. However, it uses an entirely different strategy. One disadvantage of using arrays to store data is that arrays cannot be easily extended or reduced to fit the data set. Arrays are also expensive to maintain new insertions and deletions. Linked lists addresses some of the limitations of arrays.

A linked list is a data structure that uses pointers to point to the next element in the list. It can be visualized as a chain of nodes, where every node points to the next node. Each node has two parts: a data value and a pointer.

Linked List Demo.

You may think of an array as a box with many slots. If all slots are filled, you can no longer add more items. If some items are removed, your box has some slots empty which is wasted. You may think of a linked list as many small boxes. Each box only has two slots -- one to store the item, the other stores a pointer to the next box.

© CS Wonders·About·Classes·Cheatsheet