A comprehensive collection of data structures and algorithms implemented in Java, designed for learning, practice, and interview preparation.
- Binary Trees: Implementation with preorder, inorder, postorder, and level-order traversals
- Binary Search Trees: Building, searching, deletion, and validation
- Tree Operations: Height calculation, diameter finding, lowest common ancestor, kth ancestor
- Edge and Vertex representation
- Graph Algorithms:
- Dijkstra's Algorithm for shortest paths
- Prim's Algorithm for minimum spanning trees
- Bellman-Ford Algorithm for detecting negative cycles
- Topological Sorting for directed acyclic graphs
- Node implementation with operations
- Operations: Reversing, cycle detection and removal
- Pattern operations: Delete N nodes after M nodes
- Palindrome checking in linked lists
- Priority Queue implementation
- Operations for finding maximum element in k-sized subarrays
- Character-based tree for efficient string operations
- Prefix searching and insertion
- Word finding algorithms
- Stock buying and selling algorithms
- 2D array operations
- Random array generation utilities
- Binary Search implementations
- Various sorting techniques
- Solutions to common DP problems
- Operations: Get, Set, Clear, and Update bits
- Bit counting and power of 2 checking
- Fast exponentiation using bit operations
- Solutions to classic backtracking problems
- Optimization problems with greedy approaches
- Methods for generating test data:
- Integer arrays (1D and 2D)
- String arrays with case control
- Character arrays
- Boolean arrays
- Specialized data structures
- LeetCodeTestBench for rapid algorithm testing
- Performance timing measurements
The code is organized into individual class files for each data structure or algorithm type. Each file contains multiple implementations and example usage in their respective main()
methods.
This repository is designed to complement standard algorithm and data structure courses. Each implementation includes detailed comments explaining the time and space complexity analysis.