List Linked through Nodes

Learn the workings of a node-based linked list.

Introduction to linked lists

We’ve seen that the two most natural ways of storing sequences in computer memory are arrays and linked lists. ArrayList is an ADT that uses all concepts of handling arrays more flexibly. That is why the time complexity is the same for arrays and linked lists.

Linked lists don’t work that way. We usually model the memory as a sequence of memory cells, each of which has a unique address. An array or an ArrayList is a contiguous piece of memory. Each cell of the memory stores ...