โ† Back to all tools

๐Ÿ“š Data Structure Visualiser

Push, pop, enqueue and dequeue โ€” see how stacks, queues and other data structures work with animated operations.

Designed with the WJEC specification in mind
CS A-Level Unit 3CS GCSE ยง1.2
๐Ÿ“ฆ Stack
๐Ÿšถ Queue
๐Ÿ”— Linked List
๐ŸŒณ Binary Tree
๐Ÿ—‚๏ธ Hash Table
๐Ÿ“ฆ

Stack (LIFO โ€” Last In, First Out)

Size: 0 / 8
Ready. Push some values onto the stack.
Stack operations: Push (add to top), Pop (remove from top), Peek (look at top without removing).
Real-world examples: Undo button, browser back button, function call stack, reversing a string.
Time complexity: Push O(1), Pop O(1), Peek O(1)
๐Ÿšถ

Queue (FIFO โ€” First In, First Out)

Size: 0 / 8
Ready. Enqueue some values.
Queue operations: Enqueue (add to rear), Dequeue (remove from front), Peek (look at front).
Real-world examples: Print queue, customer service queue, message buffers, CPU scheduling.
Time complexity: Enqueue O(1), Dequeue O(1), Peek O(1)
๐Ÿ”—

Linked List

Ready. Add some nodes.
Linked List: Each node stores a value AND a pointer to the next node. Unlike arrays, elements aren't stored contiguously in memory.
Advantages: Dynamic size, efficient insertion/deletion at front O(1).
Disadvantages: No random access (must traverse from head), extra memory for pointers.
๐ŸŒณ

Binary Search Tree (BST)

Insert values to build a Binary Search Tree.
Binary Search Tree (BST): Each node has at most two children. Left child is always smaller, right child is always larger.
Traversals: In-order (Leftโ†’Rootโ†’Right) gives sorted order. Pre-order (Rootโ†’Leftโ†’Right) copies the tree. Post-order (Leftโ†’Rightโ†’Root) deletes safely.
Search: O(log n) average โ€” halves the search space each step, like binary search on an array.
CS A-Level Unit 3
๐Ÿ—‚๏ธ

Hash Table

Insert key-value pairs into the hash table.
Hash Table: Uses a hash function to convert a key into an array index. Allows O(1) average lookup time โ€” much faster than searching a list.
Hash Function: Takes the key and produces a number (index). Simple example: sum of character codes mod table size.
Collisions: When two keys hash to the same index. Resolved here using linear probing โ€” if the slot is taken, try the next one.
Load Factor: Number of items รท table size. Higher load factor = more collisions = slower lookups.
CS A-Level Unit 3