Welcome to DSAWithJava β a structured and comprehensive collection of Java programs covering everything from Java fundamentals to advanced Data Structures and Algorithms.
This repository is designed to help learners, job seekers, and competitive programmers strengthen their DSA skills using Java, with well-documented solutions, problem statements, and explanations for each topic.
- β Covers Java Basics to Advanced DSA
- β Clean directory-wise topic separation
- β
Each sub-topic includes:
- π
README.mdwith explanation - π» Well-written
.javacode
- π
- β
Ideal for:
- Interview preparation
- Competitive coding
- Academic understanding
- Self-paced DSA learning
Each folder represents a major DSA topic or concept and contains:
- One or more
.javasource files - A topic-wise
README.mdfile with:- Problem descriptions
- Intuition and approach
- Code overview and complexity analysis
DSAWithJava/
βββ JavaBasics/ # Variables, Loops, Conditionals, etc.
βββ OOPs/ # Classes, Objects, Inheritance, Polymorphism
βββ Arrays/ # 1D & 2D Arrays, Prefix Sum, Sliding Window
βββ Strings/ # StringBuilder, Palindromes, Anagrams
βββ Recursion/ # Backtracking, Subsets, Permutations
βββ Sorting/ # Quick Sort, Merge Sort, Bubble, etc.
βββ Searching/ # Binary Search, Search in Rotated Array
βββ LinkedLists/ # Singly, Doubly, Reversal, Cycle Detection
βββ Stacks/ # Stack using Array/LL, Infix to Postfix
βββ Queues/ # Circular Queue, Deque, Queue using Stack
βββ Trees/ # Binary Tree, BST, Traversals, Diameter
βββ Heaps/ # Max/Min Heap, Priority Queue
βββ Tries/ # Word Break, Prefix Search, Longest Word
βββ Graphs/ # BFS, DFS, Dijkstra, Topo Sort, Kosaraju
βββ DynamicProgramming/ # Knapsack, LIS, LCS, Memoization & Tabulation
βββ Greedy/ # Activity Selection, Job Scheduling
βββ BitManipulation/ # Bitwise Operations, Power of 2, XOR Tricks
βββ README.md # β You are here!
- Variables & Data Types
- Operators & Expressions
- Conditionals and Loops
- Functions & Recursion
- Input/Output Handling
- Classes & Objects
- Constructors, Encapsulation
- Inheritance & Polymorphism
- Abstraction & Interfaces
| Topic | Concepts Included |
|---|---|
| Arrays | Prefix Sum, Kadaneβs, Subarrays |
| Strings | Character Maps, StringBuilder, Reversal |
| Linked Lists | Cycle Detection, Reversal, Merge Sort |
| Stacks & Queues | Stack using Queue, Next Greater Element |
| Trees | Traversals, Diameter, LCA, Binary Search Trees |
| Graphs | DFS, BFS, Topo Sort, Dijkstra, Kosaraju |
| Tries | Word Break, Prefix Match, Autocomplete |
| DP | Knapsack, LIS, LCS, Matrix DP |
| Greedy | Huffman Coding, Job Scheduling |
| Bitwise | XOR Tricks, Subsets, Bit Counting |
The Tries/ directory includes:
- Word Break using Trie
- Prefix Search using
startsWith() - Counting nodes in a suffix Trie
- Finding shortest unique prefix
- Finding the longest word built one char at a time
Each with:
- Problem statement
- Code walkthrough
- Time & space complexity analysis
git clone git@github.com:harshityadav-7/DSAWithJava.git
cd DSAWithJavaUse VS Code or any IDE like IntelliJ, Eclipse.
Or from terminal:
javac FileName.java
java FileNameHarshit Yadav
π Passionate about DSA, Java, Web Development, and AI
π GitHub: @harshityadav-7
Feel free to fork it, contribute, and use it in your own prep journey π
- Add LeetCode and GFG links to each problem
- Add complexity tables in each topic's README
- Add YouTube video links for explanations
- Add practice sheets and roadmaps