Data Structures
A comprehensive TypeScript library of fundamental data structures with full implementations, test coverage, and problem-solving examples.Core Data Structures
Array
Array manipulation patterns and problems
Singly Linked List
Linear data structure with forward-only traversal
Doubly Linked List
Bidirectional linked list with prev and next pointers
Stack
LIFO (Last In First Out) data structure
Queue
FIFO (First In First Out) data structure
Tree
General tree structure with multiple children
Binary Search Tree
Ordered binary tree for efficient searching
AVL Tree
Self-balancing binary search tree
Binary Heap
Priority queue implementation with heap property
Graph
Vertices and edges for modeling relationships
Quick Comparison
| Data Structure | Access | Search | Insert | Delete | Use Case |
|---|---|---|---|---|---|
| Array | O(1) | O(n) | O(n) | O(n) | Random access, fixed size |
| Linked List | O(n) | O(n) | O(1) | O(1) | Dynamic size, frequent insertions |
| Stack | O(n) | O(n) | O(1) | O(1) | LIFO operations, backtracking |
| Queue | O(n) | O(n) | O(1) | O(1) | FIFO operations, scheduling |
| BST | O(log n) | O(log n) | O(log n) | O(log n) | Sorted data, range queries |
| AVL Tree | O(log n) | O(log n) | O(log n) | O(log n) | Guaranteed balanced operations |
| Binary Heap | O(1) | O(n) | O(log n) | O(log n) | Priority queues |
| Graph | - | O(V+E) | O(1) | O(1) | Network modeling, relationships |
All implementations support generic types and include comprehensive test coverage.
Features
- Type-safe: Full TypeScript support with generics
- Well-tested: Comprehensive test suites for all structures
- Problem-solving: Includes real-world problem examples
- Production-ready: Clean, maintainable code with proper encapsulation
Getting Started
Each data structure page includes:- Complete API documentation with method signatures
- Time and space complexity analysis
- Usage examples from actual implementation
- Common problems and solutions
- Links to source code