# Linked List

## What is a Linked List? :chains:&#x20;

A **Linked List** is a sequential collection of nodes. nodes = elements

![Mario vs Donkey Kong](https://3642656209-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MLGBprg9M6rsaEbC96_%2F-MLovjVygOyUN9JAjqwM%2F-MLp6rlCvfneAKOy2coP%2Fkelly-sikkema-PgToaHfQjq0-unsplash.jpg?alt=media\&token=b1b1eab7-09c5-4be6-86f8-343e72b0d048)

## Level Progression :joystick:&#x20;

A Linked List is arranged in such a way that in order to obtain an item in the list, it must be accessed in order from start to finish. for example, the third item:clown:is wanted.&#x20;

* :space\_invader: :point\_right: :robot: :point\_right: :clown:
* The first item must be accessed, then the second, and finally the third now can be accessed.&#x20;

:joystick: In the above picture inorder for Mario to get to Donkey Kong he must travel linearly (level by level) up the ladders.:joystick:&#x20;

## How It Works :point\_right: :point\_right: :point\_right:&#x20;

Pointers! The first item in the list points to the next item in the list, the second item in the list points to the third, etc, etc. Each item in the linked list has two different pieces of information:&#x20;

* Where is the next item at? (pointer):point\_right:
* Stored data (value) :floppy\_disk:&#x20;

## Flavors of Linked Lists :ice\_cream:&#x20;

**Singly-Linked-List:** The access to the list is forward. :point\_right:&#x20;

* Life: Birth -> Child -> Teen -> Adult -> Old -> Death &#x20;

**Doubly-Linked-List:** The access to the list is forward or backwards.:point\_right: :point\_left:&#x20;

* Chain of command:  employee <-> local manager <-> regional Manager <-> CEO

**Circular-Linked-List:** The access to the list is forward and infinite. The list eventually meets up with itself, creating a loop. :point\_right::ferris\_wheel:&#x20;

* Monopoly board game: the access to properties on an never ending circle, rentee torture&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ksmcclay.gitbook.io/no-code-computer-science/data-structures/linked-list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
