Data Structures · Computer science

Linked list

Linked list is an interactive experiment in Data Structures, a free simulation from StudyFi Lab that runs right in your browser.

Each node holds a value and a next link to the following node; the last one points to null and the list starts at the head pointer. Inserting at the head costs O(1), but reaching position i or a searched value means walking node by node — O(n). Unlike an array nothing is shifted, you only relink; playlists, step histories and free-memory lists work this way.

Try this: Search for the last value and count the pointer’s steps, then insert at the head — that is always a single step.

Frequently asked questions

What does the “Linked list” experiment show?

Each node holds a value and a next link to the following node; the last one points to null and the list starts at the head pointer. Inserting at the head costs O(1), but reaching position i or a searched value means walking node by node — O(n). Unlike an array nothing is shifted, you only relink; playlists, step histories and free-memory lists work this way.

How do I try “Linked list”?

Search for the last value and count the pointer’s steps, then insert at the head — that is always a single step.

Studying for a test?

Upload your notes and StudyFi turns them into flashcards, tests and podcasts.

Try StudyFi free