DSA Lesson 10 of 33

Linked List

Learn how nodes are connected to form a linked list.

Course Progress30%

Theory

A linked list is a linear data structure made up of nodes. Each node stores data and a reference to another node. Unlike arrays, linked-list elements do not need to be stored in contiguous memory locations.

Example

class Node { constructor(value) { this.value = value; this.next = null; } } const first = new Node(10); const second = new Node(20); first.next = second; console.log(first.value); console.log(first.next.value);

Expected Output

10 and 20 are displayed.

Practice

Create a linked list containing three nodes.

Interview Questions

  1. What is a linked list?
  2. What is a node?
  3. What is the difference between an array and linked list?
  4. What is a singly linked list?