|
1 | | -# 📚 DSA with JavaScript |
| 1 | +# 🧠 JS Data Structures & Algorithms |
2 | 2 |
|
3 | | -Welcome to **DSA with JavaScript**, a comprehensive collection of Data Structures and Algorithms concepts, patterns, and problems – all solved in JavaScript. |
| 3 | +Welcome to the **JS Data Structures & Algorithms** repository! |
| 4 | +This project takes you from **JavaScript basics** all the way to **advanced DSA problems**, making it a perfect companion for interviews, competitive programming, and system design preparation. |
4 | 5 |
|
5 | | -This repository is maintained by [ExploitEngineer](https://github.com/ExploitEngineer) and is built for **beginners and intermediate learners** looking to master DSA for technical interviews, coding contests, and real-world problem solving. |
| 6 | +> 📌 Repository: `js-data-structures-algorithms` |
| 7 | +> 👨💻 Author: [ExploitEngineer](https://github.com/ExploitEngineer) |
6 | 8 |
|
7 | 9 | ---
|
8 | 10 |
|
9 | 11 | ## 📁 Topics Covered
|
10 | 12 |
|
11 | | -### ✅ Topic 1: Basic JavaScript Logic: Variables, Operators, and Operations |
12 | | -- Sum of integers, type coercion, swap variables |
| 13 | +### 1️⃣ Basic JavaScript Logic |
| 14 | +- Sum of two numbers |
| 15 | +- Type coercion & string concatenation |
| 16 | +- Swap variables (3 methods) |
13 | 17 | - Operators: Arithmetic, Relational, Logical, Unary
|
14 | | -- Math functions: `Math.round()`, `Math.sqrt()`, `Math.random()`, etc. |
15 | | -- Practical problems: Area, Perimeter, OTP generator |
| 18 | +- Math Functions: `round()`, `ceil()`, `floor()`, `trunc()`, `pow()`, `sqrt()`, `abs()`, `random()`, `toFixed()` |
| 19 | +- Problems: |
| 20 | + - Rectangle area & perimeter |
| 21 | + - OTP generator |
| 22 | + - Triangle area (Heron’s formula) |
| 23 | + - Circle circumference |
16 | 24 |
|
17 | 25 | ---
|
18 | 26 |
|
19 | | -### ✅ Topic 2: Conditional Statements and Control Flow |
20 | | -- `if`, `else`, `switch`, ternary operator |
21 | | -- Problems: Valid user, shop discount, INR denomination, etc. |
| 27 | +### 2️⃣ Conditional Statements & Control Flow |
| 28 | +- If-Else, Ternary, Switch |
| 29 | +- Problems: |
| 30 | + - Valid user checker |
| 31 | + - Shop discount logic |
| 32 | + - Utility bill (Biji bill) |
| 33 | + - INR denomination |
22 | 34 |
|
23 | 35 | ---
|
24 | 36 |
|
25 | | -### ✅ Topic 3: Loops |
26 | | -- `for`, `while`, `do-while` loops |
27 | | -- Print patterns, factorial, reverse digits, strong number, guess the number |
| 37 | +### 3️⃣ Loops |
| 38 | +- For, While, Do-While |
| 39 | +- Problems: |
| 40 | + - Print "Hello" N times |
| 41 | + - 1 to N and N to 1 |
| 42 | + - Sum & factorial |
| 43 | + - Prime number |
| 44 | + - Sum of digits |
| 45 | + - Strong number |
| 46 | + - Reverse number |
| 47 | + - Guess the number |
| 48 | + - Calculator app |
28 | 49 |
|
29 | 50 | ---
|
30 | 51 |
|
31 | | -### ✅ Topic 4: Pattern Programming |
32 | | -- Nested loops & star-pattern problems |
| 52 | +### 4️⃣ Pattern Programming |
| 53 | +- Nested loops |
| 54 | +- Classic pattern problems |
33 | 55 |
|
34 | 56 | ---
|
35 | 57 |
|
36 | | -### ✅ Topic 5: Arrays |
37 | | -- Static & dynamic arrays |
38 | | -- Max, second max, reverse, zero/one segregation |
| 58 | +### 5️⃣ Arrays |
| 59 | +- Fixed vs Dynamic arrays |
| 60 | +- Accept user input |
| 61 | +- Problems: |
| 62 | + - Sum of elements |
| 63 | + - Max & second max |
| 64 | + - Reverse array |
| 65 | + - Shift zeros left, ones right |
39 | 66 |
|
40 | 67 | ---
|
41 | 68 |
|
42 | | -### ✅ Topic 6: Strings |
43 | | -- Reverse string, palindrome check, toggle case, frequency counter |
| 69 | +### 6️⃣ Strings |
| 70 | +- String methods |
| 71 | +- Problems: |
| 72 | + - Character-by-character printing |
| 73 | + - Reverse string |
| 74 | + - Palindrome checker |
| 75 | + - Toggle case |
| 76 | + - Character frequency |
44 | 77 |
|
45 | 78 | ---
|
46 | 79 |
|
47 | | -### ✅ Topic 7: Object-Oriented Programming (OOP) |
48 | | -- Class, object, `this`, constructor, prototype, design problems |
| 80 | +### 7️⃣ Object-Oriented Programming |
| 81 | +- Class & Object |
| 82 | +- Constructor, `this`, Prototype |
| 83 | +- Design-based problems |
49 | 84 |
|
50 | 85 | ---
|
51 | 86 |
|
52 | | -## 🚀 Real Game Starts Here |
| 87 | +## 🔥 The Real DSA Journey Begins Here |
53 | 88 |
|
54 | | ---- |
55 | | - |
56 | | -### ✅ Topic 8: Advanced Array Problems |
57 | | -- Rotation, duplicate removal, merge sorted arrays |
58 | | -- Kadane’s Algo, stock buy/sell, rainwater trapping, majority element |
| 89 | +### 8️⃣ Advanced Array Questions |
| 90 | +- Left/Right rotation by K |
| 91 | +- Remove duplicates (sorted array) |
| 92 | +- Merge sorted arrays |
| 93 | +- Best time to buy & sell stock |
| 94 | +- Sort colors |
| 95 | +- Kadane’s Algorithm |
| 96 | +- Moore’s Voting |
| 97 | +- Trapping Rain Water |
59 | 98 |
|
60 | 99 | ---
|
61 | 100 |
|
62 | | -### ✅ Topic 9: Sorting Algorithms - Part 1 |
63 | | -- Bubble Sort, Selection Sort, Insertion Sort |
| 101 | +### 9️⃣ Sorting Algorithms (Part 1) |
| 102 | +- Bubble Sort |
| 103 | +- Selection Sort |
| 104 | +- Insertion Sort |
| 105 | + |
| 106 | +### 🔟 Sorting Algorithms (Part 2) |
| 107 | +- Merge Sort |
| 108 | +- Quick Sort |
64 | 109 |
|
65 | 110 | ---
|
66 | 111 |
|
67 | | -### ✅ Topic 10: Sorting Algorithms - Part 2 |
68 | | -- Quick Sort, Merge Sort |
| 112 | +### 1️⃣1️⃣ Cyclic Sort |
| 113 | +- Missing number |
| 114 | +- Disappeared numbers |
| 115 | +- First missing positive |
69 | 116 |
|
70 | 117 | ---
|
71 | 118 |
|
72 | | -### ✅ Topic 11: Cyclic Sort |
73 | | -- Missing number, first positive, disappeared numbers |
| 119 | +## 📌 Binary Search |
| 120 | +- Classic Binary Search |
| 121 | +- Search Insert Position |
| 122 | +- Rotated Sorted Array |
| 123 | +- Book Allocation |
| 124 | +- Koko Eating Bananas |
| 125 | +- Threshold limit problems |
74 | 126 |
|
75 | 127 | ---
|
76 | 128 |
|
77 | | -### ✅ Binary Search Problems |
78 | | -- Classic binary search, rotated array, Koko eating bananas, book allocation |
| 129 | +## 🧠 Hashing |
| 130 | +- Frequency map |
| 131 | +- Unique elements |
| 132 | +- Pangram checker |
| 133 | +- Sort by people |
| 134 | +- Two Sum |
| 135 | +- Subarray sum equals K |
| 136 | +- Longest subarray with sum K |
| 137 | +- Longest consecutive sequence |
79 | 138 |
|
80 | 139 | ---
|
81 | 140 |
|
82 | | -### ✅ Hashing |
83 | | -- Frequency count, two sum, pangram check, subarray with sum K |
| 141 | +## 🔗 Linked List |
| 142 | +- Implementation |
| 143 | +- Design LL |
| 144 | +- Find middle |
| 145 | +- Detect cycle |
| 146 | +- Reverse list |
| 147 | +- Delete node |
| 148 | +- Reverse in K groups |
84 | 149 |
|
85 | 150 | ---
|
86 | 151 |
|
87 | | -### ✅ Linked List |
88 | | -- Basic operations, reverse, middle, cycle, k-group reverse |
| 152 | +## 📚 Stack & Queue |
| 153 | +- Stack & Queue implementation |
| 154 | +- Valid parentheses |
| 155 | +- Stack using queue |
| 156 | +- Queue using stack |
| 157 | +- Next greater element |
| 158 | +- Largest rectangle in histogram |
89 | 159 |
|
90 | 160 | ---
|
91 | 161 |
|
92 | | -### ✅ Stack and Queue |
93 | | -- Implementations, valid parentheses, NGE, histograms |
| 162 | +## 🔁 Recursion & Backtracking |
| 163 | +- Print Hello N times |
| 164 | +- N to 1, 1 to N |
| 165 | +- Sum & factorial |
| 166 | +- Digit sum |
| 167 | +- Fibonacci (2 ways) |
| 168 | +- Tower of Hanoi |
| 169 | +- Josephus problem |
| 170 | +- Subsets & permutations |
| 171 | +- Combination sum |
| 172 | +- Sudoku solver |
94 | 173 |
|
95 | 174 | ---
|
96 | 175 |
|
97 | | -### ✅ Recursion & Backtracking |
98 | | -- Fibonacci, Tower of Hanoi, subsets, permutations, Sudoku solver |
| 176 | +## 🌳 Binary Tree |
| 177 | +- Implementation |
| 178 | +- DFS (Pre, In, Post) |
| 179 | +- Max depth |
| 180 | +- Symmetric tree |
| 181 | +- BFS |
| 182 | +- Left & Top view |
| 183 | +- Lowest Common Ancestor |
| 184 | +- Build tree (Preorder + Inorder) |
99 | 185 |
|
100 | 186 | ---
|
101 | 187 |
|
102 | | -### ✅ Binary Tree |
103 | | -- Traversals (DFS/BFS), max depth, symmetry, top/left view, LCA, tree construction |
| 188 | +## 🌲 Binary Search Tree |
| 189 | +- Validate BST |
| 190 | +- Kth smallest in BST |
| 191 | +- Delete node from BST |
104 | 192 |
|
105 | 193 | ---
|
106 | 194 |
|
107 | | -### ✅ Binary Search Tree (BST) |
108 | | -- Validate BST, kth smallest, BST node deletion |
| 195 | +## 🌐 Graph |
| 196 | +- Graph implementation |
| 197 | +- BFS & DFS |
| 198 | +- Cycle detection |
| 199 | +- Topological sort |
| 200 | +- Shortest Path Algorithms |
109 | 201 |
|
110 | 202 | ---
|
111 | 203 |
|
112 | | -### ✅ Graphs |
113 | | -- BFS, DFS, cycle detection, topological sort, shortest path algorithms |
| 204 | +## ⚙️ Tech Stack |
| 205 | +- Language: JavaScript (ES6+) |
| 206 | +- Tools: Git, GitHub, Notion (for notes) |
| 207 | +- Practice Style: Problem-first, then explanation |
114 | 208 |
|
115 | 209 | ---
|
116 | 210 |
|
117 | | -## 🧠 Goal |
118 | | -Build a **solid understanding** of all DSA concepts in JavaScript and create an easy-to-reference solution base for future interviews and projects. |
| 211 | +## 🛠️ Setup |
119 | 212 |
|
120 | | ---- |
| 213 | +```bash |
| 214 | +# Clone this repo |
| 215 | +git clone git@github.com:ExploitEngineer/js-data-structures-algorithms.git |
121 | 216 |
|
122 | | -## 📌 Contribution |
123 | | -This is a personal learning repository. However, feel free to fork it and use the structure for your own learning journey. |
| 217 | +# Move into project folder |
| 218 | +cd js-data-structures-algorithms |
124 | 219 |
|
125 | | ---- |
| 220 | +🙌 Contribute |
| 221 | +If you find bugs or want to improve the code/docs: |
126 | 222 |
|
127 | | -## 📬 Stay Connected |
128 | | -Follow my journey on [GitHub](https://github.com/ExploitEngineer) and feel free to connect if you’re learning along too! |
| 223 | +Star ⭐ this repo |
| 224 | +Fork 🍴 the project |
| 225 | +Open a PR or Issue |
129 | 226 |
|
130 | | ---- |
| 227 | +📄 License |
| 228 | +MIT License — feel free to use, modify, or share! |
131 | 229 |
|
132 | | -**Let's crack DSA together – one problem at a time. 💻✨** |
| 230 | +Happy coding, keep learning, and never stop solving! 🚀✨ |
133 | 231 |
|
0 commit comments