Skip to content

krishanthan4/LetsLearn--data_structures_and_algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DSA Practice Ground πŸš€

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.

πŸ“š Overview

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

🎯 Philosophy

"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:

  1. Read the wiki guide to understand the problem
  2. Implement the algorithm/data structure
  3. Uncomment and run tests to verify
  4. Iterate until all tests pass

πŸ—οΈ Project Structure

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]

πŸš€ Getting Started

Prerequisites

  • Java 23 or higher
  • Maven 3.6+
  • Your favorite IDE (IntelliJ IDEA, Eclipse, VS Code)

Installation

  1. Clone the repository:
git clone <your-repo-url>
cd data-structures-self-learning
  1. Build the project:
mvn clean install
  1. Run tests:
mvn test

πŸ“– How to Use This Repository

Step 1: Choose a Topic

Browse the available algorithms and data structures. Start with simpler ones like:

  • Linear Search
  • Bubble Sort
  • Stack
  • Queue

Step 2: Read the Wiki Guide

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.md

Step 3: Implement

Open the corresponding Java file and implement the methods marked with TODO:

public int search(int[] arr, int target) {
    // TODO: Implement linear search
    
}

Step 4: Test

Uncomment the tests in the corresponding test file and run them:

# Run specific test class
mvn test -Dtest=LinearSearchTest

# Run all tests
mvn test

Step 5: Iterate

Keep refining your implementation until all tests pass!

πŸ“Š Available Data Structures

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

πŸ” Available Algorithms

Searching Algorithms

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

Sorting Algorithms

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

Graph Algorithms

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

Dynamic Programming

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

πŸ§ͺ Testing

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#testIterativeSearchFound

Test Structure

Tests are initially commented out with TODO markers. As you implement each method:

  1. Uncomment the corresponding tests
  2. Run the tests
  3. Fix issues until tests pass
  4. Move to the next method

πŸ’‘ Learning Path

For Absolute Beginners

  1. Week 1-2: Basic Data Structures

    • ArrayList
    • LinkedList
    • Stack
    • Queue
  2. Week 3-4: Basic Algorithms

    • Linear Search
    • Binary Search
    • Bubble Sort
    • Insertion Sort

For Intermediate Learners

  1. Week 1-2: Advanced Data Structures

    • Binary Search Tree
    • Heap
    • Trie
    • Graph
  2. Week 3-4: Advanced Algorithms

    • DFS/BFS
    • Merge Sort
    • Quick Sort
    • Dijkstra's Algorithm

For Advanced Learners

  1. Week 1-2: Complex Structures

    • LRU Cache
    • HashMap (from scratch)
    • Graph with advanced operations
  2. Week 3-4: Advanced Algorithms

    • Dynamic Programming problems
    • Topological Sort
    • Advanced graph algorithms

🀝 Contributing

This is a learning project! Contributions are welcome:

  1. Fork the repository
  2. Create a feature branch
  3. Add new algorithms/data structures with:
    • Skeleton implementation
    • Comprehensive tests
    • Wiki guide (problem only, no solution!)
  4. Submit a pull request

πŸ“ Best Practices

  1. Read the wiki guide first - Don't peek at solutions online immediately
  2. Think about edge cases - Empty inputs, single elements, large inputs
  3. Consider time/space complexity - Try to match the target complexity
  4. Write clean code - Use meaningful variable names, add comments
  5. Test thoroughly - Make sure all test cases pass
  6. Understand, don't memorize - Focus on understanding the concept

πŸ”§ IDE Setup

IntelliJ IDEA

  1. Open the project
  2. Right-click on test file β†’ Run 'TestName'
  3. Use Ctrl+Shift+F10 (Windows) or Cmd+Shift+R (Mac) to run tests

VS Code

  1. Install Java Extension Pack
  2. Install Test Runner for Java
  3. Click "Run Test" above test methods

Eclipse

  1. Import as Maven project
  2. Right-click test file β†’ Run As β†’ JUnit Test

πŸ“š Additional Resources

⚠️ Common Mistakes to Avoid

  1. Skipping the wiki guide - Always understand the problem first
  2. Copy-pasting solutions - You won't learn that way!
  3. Ignoring test cases - Tests are there to help you
  4. Not considering edge cases - Think about null, empty, single element
  5. Giving up too early - Struggle is part of learning!

πŸ“ˆ Progress Tracking

Create a personal progress tracker:

## My Progress

### Data Structures
- [x] ArrayList
- [x] LinkedList
- [ ] Stack
- [ ] Queue
...

### Algorithms
- [x] Linear Search
- [ ] Binary Search
...

πŸŽ“ Learning Tips

  1. Start simple - Don't jump to advanced topics
  2. Practice daily - Consistency beats intensity
  3. Draw it out - Visualize the algorithm
  4. Explain to others - Teaching solidifies understanding
  5. Time yourself - Practice coding under time pressure

πŸ“§ Support

If you're stuck:

  1. Re-read the wiki guide
  2. Check the test cases for hints
  3. Draw the problem on paper
  4. Take a break and come back
  5. Ask for help in discussions (explain what you've tried!)

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 Acknowledgments

  • 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! πŸ’»