Linked Lists

What is a Linked List?

Very similar to arrays, linked lists store elements in sequential order. Unlike arrays, elements are not stored in a particular location or index. Rather each element is a separate object that contains a pointer or a link to the next object in that list Instead of keeping indexes, linked lists hold pointers to other elements. The first node is called the head while the last node is called the tail.

Types of Linked Lists

In a doubly-linked list, a link to the previous node is also kept. Therefore, we can also start from the tail and traverse backward toward the head.

A circular -linked Lists acts as a variation of a linked list in which the last node points to the first node or any other node before it, thereby forming a loop.

Why Linked Lists?

A disadvantage of using a linked list over an array is search operations are much slower in linked lists. Random access of data elements is not allowed like they are in arrays. Nodes are accessed sequentially starting from the head node to the tail node.

--

--

Full-Stack Software Engineer / New York City / www.danielcreyes.dev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store