This repository hosts a curated collection of fundamental data structures implemented from scratch. From foundational linear structures to advanced trees and hash-based structures, this repository serves as a resource for understanding the inner workings of key data structures in computer science.
A dynamic array that supports random access and amortized constant-time insertions at the end.
Sequential structures where elements point to the next (and optionally previous) node.
- Singly Linked List – nodes linked in one direction.
- Doubly Linked List – nodes linked in both directions.
Memory-efficient structures for representing arrays and matrices with many zero or default values.
A Last-In-First-Out (LIFO) structure used for backtracking, parsing, and more.
A First-In-First-Out (FIFO) structure useful in scheduling and buffering systems.
A hierarchical structure where each node has up to two children.
A binary tree where the left child is less than the node, and the right child is greater — enables fast lookups, insertions, and deletions.
A complete binary tree used for priority queues that maintains the heap property.
A self-balancing binary search tree that maintains height balance to ensure O(log n) operations.
A prefix tree that supports fast insertion and lookup of strings with shared prefixes.
A structure that maps keys to values using a hash function — supports average-case constant-time operations.
A compact tree-like structure for efficiently computing prefix sums and handling updates in logarithmic time.
A binary tree used for range queries and updates in logarithmic time.
- Range Sum Query – efficiently computes sum over a range.
- Range Minimum Query – finds the minimum element in a range.
- Range Maximum Query – finds the maximum element in a range.