A comprehensive Data Structures and Algorithms learning platform built in Java. This project provides skeleton implementations with extensive tests and detailed wiki guides to help you learn and practice DSA concepts.
This is a practice-oriented DSA repository where:
- Each algorithm/data structure has a skeleton implementation with TODO markers
- Comprehensive JUnit tests are provided (commented out until you implement)
- Wiki guides explain the problem without giving away the solution
- You learn by implementing, not just reading
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
This project follows a hands-on learning approach:
- Read the wiki guide to understand the problem
- Implement the algorithm/data structure
- Uncomment and run tests to verify
- Iterate until all tests pass
src/
βββ main/java/com/dsa/
β βββ algorithms/
β β βββ searching/
β β β βββ LinearSearch.java
β β β βββ BinarySearch.java
β β β βββ Depth_First_Search.java
β β β βββ Breadth_First_Search.java
β β βββ sorting/
β β β βββ BubbleSort.java
β β β βββ SelectionSort.java
β β β βββ InsertionSort.java
β β β βββ MergeSort.java
β β β βββ QuickSort.java
β β βββ Traversal/
β β β βββ In_Order_Traversal.java
β β β βββ Pre_Order_Traversal.java
β β β βββ Post_Order_Traversal.java
β β βββ graph/
β β β βββ Dijkstra.java
β β β βββ TopologicalSort.java
β β βββ dynamic_programming/
β β βββ Fibonacci.java
β β βββ Knapsack.java
β β βββ LongestCommonSubsequence.java
β βββ data_structures/
β βββ ArrayList.java
β βββ LinkedList.java
β βββ Stack.java
β βββ Queue.java
β βββ Graph.java
β βββ LRUCache.java
β βββ HashMap.java
β βββ Heap/
β β βββ MinHeap.java
β β βββ MaxHeap.java
β βββ Tree/
β βββ Tree.java (BST)
β βββ Trie.java
βββ test/java/com/dsa/
β βββ [Comprehensive JUnit tests for all implementations]
βββ wiki/
βββ [Detailed guides for each algorithm/data structure]
- Java 23 or higher
- Maven 3.6+
- Your favorite IDE (IntelliJ IDEA, Eclipse, VS Code)
- Clone the repository:
git clone <your-repo-url>
cd data-structures-self-learning- Build the project:
mvn clean install- Run tests:
mvn testBrowse the available algorithms and data structures. Start with simpler ones like:
- Linear Search
- Bubble Sort
- Stack
- Queue
Each topic has a comprehensive wiki guide in the wiki/ directory:
- Problem description
- Complexity analysis
- How it works
- Hints (NO direct solutions!)
- Test cases to consider
- Common pitfalls
Example:
# Read the Linear Search guide
cat wiki/LinearSearch.mdOpen the corresponding Java file and implement the methods marked with TODO:
public int search(int[] arr, int target) {
// TODO: Implement linear search
}Uncomment the tests in the corresponding test file and run them:
# Run specific test class
mvn test -Dtest=LinearSearchTest
# Run all tests
mvn testKeep refining your implementation until all tests pass!
| Data Structure | Difficulty | Wiki Guide |
|---|---|---|
| ArrayList | β Beginner | wiki/ArrayList.md |
| LinkedList | β Beginner | wiki/LinkedList.md |
| Stack | β Beginner | wiki/Stack.md |
| Queue | β Beginner | wiki/Queue.md |
| Binary Search Tree | ββ Intermediate | wiki/BinarySearchTree.md |
| Min/Max Heap | ββ Intermediate | wiki/MinHeap.md |
| Trie | ββ Intermediate | wiki/Trie.md |
| Graph | ββ Intermediate | wiki/Graph.md |
| HashMap | ββ Intermediate | wiki/HashMap.md |
| LRU Cache | βββ Advanced | wiki/LRUCache.md |
| Algorithm | Difficulty | Time Complexity | Wiki Guide |
|---|---|---|---|
| Linear Search | β Beginner | O(n) | wiki/LinearSearch.md |
| Binary Search | β Beginner | O(log n) | wiki/BinarySearch.md |
| DFS | ββ Intermediate | O(V + E) | wiki/DepthFirstSearch.md |
| BFS | ββ Intermediate | O(V + E) | wiki/BreadthFirstSearch.md |
| Algorithm | Difficulty | Time Complexity | Wiki Guide |
|---|---|---|---|
| Bubble Sort | β Beginner | O(nΒ²) | wiki/BubbleSort.md |
| Selection Sort | β Beginner | O(nΒ²) | wiki/SelectionSort.md |
| Insertion Sort | β Beginner | O(nΒ²) | wiki/InsertionSort.md |
| Merge Sort | ββ Intermediate | O(n log n) | wiki/MergeSort.md |
| Quick Sort | ββ Intermediate | O(n log n) | wiki/QuickSort.md |
| Algorithm | Difficulty | Time Complexity | Wiki Guide |
|---|---|---|---|
| Dijkstra's | βββ Advanced | O((V+E) log V) | wiki/Dijkstra.md |
| Topological Sort | ββ Intermediate | O(V + E) | wiki/TopologicalSort.md |
| Algorithm | Difficulty | Time Complexity | Wiki Guide |
|---|---|---|---|
| Fibonacci | β Beginner | O(n) | wiki/Fibonacci.md |
| 0/1 Knapsack | ββ Intermediate | O(nW) | wiki/Knapsack.md |
| LCS | ββ Intermediate | O(mn) | wiki/LongestCommonSubsequence.md |
All implementations come with comprehensive JUnit 5 tests:
# Run all tests
mvn test
# Run tests with coverage
mvn test jacoco:report
# Run specific test class
mvn test -Dtest=BinarySearchTest
# Run specific test method
mvn test -Dtest=BinarySearchTest#testIterativeSearchFoundTests are initially commented out with TODO markers. As you implement each method:
- Uncomment the corresponding tests
- Run the tests
- Fix issues until tests pass
- Move to the next method
-
Week 1-2: Basic Data Structures
- ArrayList
- LinkedList
- Stack
- Queue
-
Week 3-4: Basic Algorithms
- Linear Search
- Binary Search
- Bubble Sort
- Insertion Sort
-
Week 1-2: Advanced Data Structures
- Binary Search Tree
- Heap
- Trie
- Graph
-
Week 3-4: Advanced Algorithms
- DFS/BFS
- Merge Sort
- Quick Sort
- Dijkstra's Algorithm
-
Week 1-2: Complex Structures
- LRU Cache
- HashMap (from scratch)
- Graph with advanced operations
-
Week 3-4: Advanced Algorithms
- Dynamic Programming problems
- Topological Sort
- Advanced graph algorithms
This is a learning project! Contributions are welcome:
- Fork the repository
- Create a feature branch
- Add new algorithms/data structures with:
- Skeleton implementation
- Comprehensive tests
- Wiki guide (problem only, no solution!)
- Submit a pull request
- Read the wiki guide first - Don't peek at solutions online immediately
- Think about edge cases - Empty inputs, single elements, large inputs
- Consider time/space complexity - Try to match the target complexity
- Write clean code - Use meaningful variable names, add comments
- Test thoroughly - Make sure all test cases pass
- Understand, don't memorize - Focus on understanding the concept
- Open the project
- Right-click on test file β Run 'TestName'
- Use Ctrl+Shift+F10 (Windows) or Cmd+Shift+R (Mac) to run tests
- Install Java Extension Pack
- Install Test Runner for Java
- Click "Run Test" above test methods
- Import as Maven project
- Right-click test file β Run As β JUnit Test
- Visualgo - Algorithm visualizations
- Big-O Cheat Sheet - Complexity reference
- LeetCode - Practice problems
- GeeksforGeeks - Detailed explanations
- Skipping the wiki guide - Always understand the problem first
- Copy-pasting solutions - You won't learn that way!
- Ignoring test cases - Tests are there to help you
- Not considering edge cases - Think about null, empty, single element
- Giving up too early - Struggle is part of learning!
Create a personal progress tracker:
## My Progress
### Data Structures
- [x] ArrayList
- [x] LinkedList
- [ ] Stack
- [ ] Queue
...
### Algorithms
- [x] Linear Search
- [ ] Binary Search
...- Start simple - Don't jump to advanced topics
- Practice daily - Consistency beats intensity
- Draw it out - Visualize the algorithm
- Explain to others - Teaching solidifies understanding
- Time yourself - Practice coding under time pressure
If you're stuck:
- Re-read the wiki guide
- Check the test cases for hints
- Draw the problem on paper
- Take a break and come back
- Ask for help in discussions (explain what you've tried!)
This project is licensed under the MIT License - see the LICENSE file for details.
- Created as a comprehensive DSA learning platform
- Inspired by various coding interview preparation resources
- Built with β€οΈ for learners
Remember: The goal is not to finish quickly, but to understand deeply. Take your time, struggle with the problems, and enjoy the learning journey! π
Happy Coding! π»