DSA
    beginner

    Linked List

    Linked List

    Dynamic Size
    Ready

    Linked List Structure

    Ready to perform linked list operations

    Head → NULL
    List is empty
    Normal
    Visiting
    New
    Found/Deleting
    Nodes
    0
    Operation
    complete
    Position
    -
    Memory
    O(n)

    Reverse a singly linked list

    Sequence

    Order one iteration of the three-pointer reversal, from set-up to finish.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    5 pieces left to place

    Test your knowledge

    20 questions
    Question 1 of 20
    Score: 0

    What is the time complexity to access the Nth element?

    The short version

    Think of a treasure hunt where each clue tells you exactly where to find the next clue. You can't skip ahead; you must follow the chain. Unlike a bookshelf (Array) where you can grab the 5th book instantly.

    In more depth

    Dynamic Chains

    A Linked List is a linear data structure where elements are not stored in contiguous memory locations. Instead, each element (node) points to the next.

    Pros vs Arrays:

    Dynamic Size: Can grow or shrink indefinitely (until memory runs out).
    Efficient Insert/Delete: Inserting at the beginning or middle (if you have the pointer) is O(1), unlike arrays which require shifting elements O(n).

    Cons:

    No Random Access: You cannot jump to index i. You must traverse from the head.
    Extra Memory: Overhead for storing pointers.

    Tortoise and Hare:

    A classic technique for Linked Lists is using two pointers moving at different speeds to detect cycles or find the middle element.

    When to reach for this

    • When size is unknown or changes frequently
    • When you need constant time Insert/Delete at the start
    • Implementing Stacks or Queues

    Interview Questions

    Amazon
    Google
    Netflix
    Microsoft
    Apple
    LinkedIn
    Amazon
    Uber
    Bloomberg
    Google
    Facebook
    Airbnb

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required