Tag: collections


  • Stack

    Overview A Stack is a linear data structure that follows the LIFO (Last-In, First-Out) principle. The last element added to the stack is the first one to be removed. Think of it like a stack of physical plates. Core Concepts Push: Adding an element to the top of the stack. Pop: Removing the top element…

  • Queue

    Overview A Queue is a linear data structure that follows the FIFO (First-In, First-Out) principle. The first element added to the queue is the first one to be removed. Think of it like a line of people waiting for a bus. Core Concepts Enqueue: Adding an element to the end (rear) of the queue. Dequeue:…

  • Overview A Linked List is a linear collection of data elements called nodes, where each node contains a data field and a reference (link) to the next node in the sequence. Unlike arrays, linked lists are not stored in contiguous memory locations. Core Concepts Node: The basic building block. Contains data and a next pointer.…

  • Overview A Hash Table (or Hash Map/Dictionary) is a data structure that maps keys to values using a hash function. It allows for extremely fast data retrieval by converting a key into an index in an underlying array. Core Concepts Hash Function: An algorithm that takes an input (key) and returns a fixed-size integer (hash),…

  • Array

    Overview An array is a linear data structure that collects multiple elements of the same type (usually) stored in contiguous memory locations. Elements are accessed using a numerical index. Core Concepts Indexing: Most languages use zero-based indexing, where the first element is at index 0. Contiguous Memory: Elements are stored side-by-side in memory, allowing for…