Data Structures
- Hash Tables
Hash tables, also known as hash maps or dictionaries in some programming languages, are data structures that store key-value pairs. They use a technique called hashing to efficiently retrieve and store data based on keys.
Here’s a basic overview of how hash tables work:
Hash Function: A hash function is used to convert keys into array indices. It takes a key as input and computes a hash code, which is typically an integer. This hash code is then mapped to an index in the hash table’s underlying array.
- Heap Data Structure
The heap data structure is a binary tree-based data structure that satisfies the heap property. It is commonly implemented as an array, where the parent-child relationships are determined by the indices of the array elements. There are two main types of heaps: max heaps and min heaps.
Max Heap: In a max heap, every parent node has a value greater than or equal to the values of its children. The maximum value is stored at the root of the heap.
- Queue Data Structure
A Queue is a linear data struture that is open at both ends. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). In can be thought of as a queue of poeple waiting to get tickets, the first person in line will be the first one called to purchase their ticket.

Waiting in Queue Basic Operations
enqueue() − add (store) an item to the queue.
- Stack Data Structure
The stack data structure is a fundamental abstract data type commonly used in computer science and software engineering. It follows the Last-In, First-Out (LIFO) principle, meaning that the last element added to the stack is the first one to be removed. Think of it like a stack of plates: you can only add or remove plates from the top of the stack.

Stack of pancakes Basic Operations
- Push: Adding an element to the top of the stack.
- Pop: Removing the top element from the stack.
- Peek (or Top): Viewing the top element of the stack without removing it.
- isEmpty: Checking if the stack is empty.
- Size: Returning the number of elements currently in the stack.
Implementations
- Stacks can be implemented using various data structures, including arrays and linked lists.
- Arrays are commonly used for implementing stacks due to their simplicity and constant-time access to elements.
- Linked lists can also be used, providing dynamic memory allocation and flexibility.
A stack implemented using an array
A stack implemented using a Linked List.
- Linked List Data Structure
A linked list is a linear collection of data elements, their order is not given by their physical placement in memory. Instead they are constructed in such a way that each element points to the next. It is a data structure that consists of a collection of nodes which together represents a sequence.

Nodes linked together Linked lists can be singly or doubly linked.