dsa_visualizer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +323 -0
- data/USAGE.md +359 -0
- data/bin/dsa_visualizer +5 -0
- data/lib/dsa_visualizer/algorithms/dynamic_programming.rb +23 -0
- data/lib/dsa_visualizer/algorithms/graph_algorithms.rb +23 -0
- data/lib/dsa_visualizer/algorithms/greedy.rb +11 -0
- data/lib/dsa_visualizer/algorithms/searching.rb +78 -0
- data/lib/dsa_visualizer/algorithms/sorting.rb +77 -0
- data/lib/dsa_visualizer/algorithms/string_algorithms.rb +11 -0
- data/lib/dsa_visualizer/cli.rb +281 -0
- data/lib/dsa_visualizer/comparator.rb +57 -0
- data/lib/dsa_visualizer/data_structures/array.rb +109 -0
- data/lib/dsa_visualizer/data_structures/binary_tree.rb +104 -0
- data/lib/dsa_visualizer/data_structures/bst.rb +11 -0
- data/lib/dsa_visualizer/data_structures/deque.rb +11 -0
- data/lib/dsa_visualizer/data_structures/doubly_linked_list.rb +11 -0
- data/lib/dsa_visualizer/data_structures/graph.rb +11 -0
- data/lib/dsa_visualizer/data_structures/hash_table.rb +61 -0
- data/lib/dsa_visualizer/data_structures/heap.rb +17 -0
- data/lib/dsa_visualizer/data_structures/linked_list.rb +197 -0
- data/lib/dsa_visualizer/data_structures/priority_queue.rb +11 -0
- data/lib/dsa_visualizer/data_structures/queue.rb +110 -0
- data/lib/dsa_visualizer/data_structures/stack.rb +207 -0
- data/lib/dsa_visualizer/data_structures/string.rb +11 -0
- data/lib/dsa_visualizer/data_structures/trie.rb +11 -0
- data/lib/dsa_visualizer/data_structures/union_find.rb +11 -0
- data/lib/dsa_visualizer/fundamentals/complexity.rb +264 -0
- data/lib/dsa_visualizer/fundamentals/memory.rb +285 -0
- data/lib/dsa_visualizer/fundamentals/pointers.rb +311 -0
- data/lib/dsa_visualizer/fundamentals/recursion.rb +63 -0
- data/lib/dsa_visualizer/memory_tracker.rb +49 -0
- data/lib/dsa_visualizer/notes_manager.rb +85 -0
- data/lib/dsa_visualizer/version.rb +3 -0
- data/lib/dsa_visualizer/visualizer.rb +58 -0
- data/lib/dsa_visualizer.rb +114 -0
- metadata +157 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5280e73e1e1cfd6f1a2f896d689044085977ec5d73f1a2f2d0def717509d1763
|
|
4
|
+
data.tar.gz: 7f4eeb0841cbe5e5710cb51908e3ca1e371167413bde705d052aff5f3afc1f71
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 20538083c06fef9dc44c37278f2a3942fca9b2b71aaccfe2e5144d71ef57d088ea27e445db37255f7bf1d1065dd547c126bd0e0d796b4c08d62a515d82d20a32
|
|
7
|
+
data.tar.gz: f5815ec1183948b93e616e9067c01de2e6574b06c470cab19a7ad66919ae82d337ee3bb9f2e81113434b2549203533a2405dfe537ad1e2404f41feeec4104a25
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DSA Visualizer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# DSA Visualizer - Zero to Hero
|
|
2
|
+
|
|
3
|
+
A comprehensive Ruby gem for learning Data Structures and Algorithms from scratch by visualizing concepts at the core level, comparing Ruby and C++ implementations with step-by-step execution details, detailed notes, and practice problems.
|
|
4
|
+
|
|
5
|
+
## 🎯 Features
|
|
6
|
+
|
|
7
|
+
- 📚 **Complete DSA Curriculum**: 12 sections covering fundamentals to advanced topics
|
|
8
|
+
- 🎨 **Visual Representations**: ASCII art visualizations of data structures
|
|
9
|
+
- 🔄 **Ruby vs C++ Comparisons**: Side-by-side implementation comparisons
|
|
10
|
+
- 🧠 **Core Level Explanations**: Deep dive into memory layout and internal workings
|
|
11
|
+
- 📊 **Memory Tracking**: Track allocations and operations
|
|
12
|
+
- ⏱️ **Complexity Analysis**: Time and space complexity for every operation
|
|
13
|
+
- 📝 **Detailed Notes**: Important points, common mistakes, best practices
|
|
14
|
+
- 🎯 **Real-World Examples**: Practical use cases for each concept
|
|
15
|
+
- 💪 **Practice Problems**: Curated problems for each topic
|
|
16
|
+
- 📈 **Progress Tracking**: Track your learning journey
|
|
17
|
+
- 🖥️ **Interactive CLI**: Command-based navigation through topics
|
|
18
|
+
|
|
19
|
+
## 📚 Complete Curriculum
|
|
20
|
+
|
|
21
|
+
### 1. Fundamentals
|
|
22
|
+
- Time & Space Complexity (Big O Notation)
|
|
23
|
+
- Memory Management (Stack vs Heap)
|
|
24
|
+
- Pointers & References
|
|
25
|
+
- Recursion Basics
|
|
26
|
+
|
|
27
|
+
### 2. Basic Data Structures
|
|
28
|
+
- Arrays
|
|
29
|
+
- Strings
|
|
30
|
+
- Linked Lists (Singly, Doubly, Circular)
|
|
31
|
+
|
|
32
|
+
### 3. Stack & Queue
|
|
33
|
+
- Stack (Array-based & Linked List-based)
|
|
34
|
+
- Queue (Array-based & Linked List-based)
|
|
35
|
+
- Circular Queue
|
|
36
|
+
- Deque
|
|
37
|
+
- Priority Queue
|
|
38
|
+
|
|
39
|
+
### 4. Hashing
|
|
40
|
+
- Hash Functions
|
|
41
|
+
- Hash Tables
|
|
42
|
+
- Collision Handling (Chaining, Open Addressing)
|
|
43
|
+
- Hash Maps & Sets
|
|
44
|
+
|
|
45
|
+
### 5. Trees
|
|
46
|
+
- Binary Trees
|
|
47
|
+
- Binary Search Trees (BST)
|
|
48
|
+
- Tree Traversals (Inorder, Preorder, Postorder, Level-order)
|
|
49
|
+
- AVL Trees
|
|
50
|
+
- Red-Black Trees
|
|
51
|
+
- B-Trees
|
|
52
|
+
- Segment Trees
|
|
53
|
+
- Fenwick Trees (Binary Indexed Tree)
|
|
54
|
+
- Trie (Prefix Tree)
|
|
55
|
+
|
|
56
|
+
### 6. Heaps
|
|
57
|
+
- Min Heap & Max Heap
|
|
58
|
+
- Heap Operations (Insert, Extract, Heapify)
|
|
59
|
+
- Heap Sort
|
|
60
|
+
|
|
61
|
+
### 7. Graphs
|
|
62
|
+
- Graph Representations (Adjacency Matrix, Adjacency List)
|
|
63
|
+
- BFS (Breadth-First Search)
|
|
64
|
+
- DFS (Depth-First Search)
|
|
65
|
+
- Topological Sort
|
|
66
|
+
- Shortest Path Algorithms (Dijkstra, Bellman-Ford)
|
|
67
|
+
- Minimum Spanning Tree (Kruskal, Prim)
|
|
68
|
+
- Floyd-Warshall Algorithm
|
|
69
|
+
|
|
70
|
+
### 8. Sorting Algorithms
|
|
71
|
+
- Bubble Sort, Selection Sort, Insertion Sort
|
|
72
|
+
- Merge Sort, Quick Sort, Heap Sort
|
|
73
|
+
- Counting Sort, Radix Sort, Bucket Sort
|
|
74
|
+
|
|
75
|
+
### 9. Searching Algorithms
|
|
76
|
+
- Linear Search, Binary Search
|
|
77
|
+
- Ternary Search, Jump Search
|
|
78
|
+
- Interpolation Search
|
|
79
|
+
|
|
80
|
+
### 10. Advanced Algorithms
|
|
81
|
+
- Dynamic Programming (Fibonacci, Knapsack, LCS, Matrix Chain)
|
|
82
|
+
- Greedy Algorithms
|
|
83
|
+
- Backtracking
|
|
84
|
+
- Divide and Conquer
|
|
85
|
+
|
|
86
|
+
### 11. String Algorithms
|
|
87
|
+
- Pattern Matching (Naive, KMP, Rabin-Karp)
|
|
88
|
+
- Z Algorithm
|
|
89
|
+
|
|
90
|
+
### 12. Advanced Data Structures
|
|
91
|
+
- Disjoint Set (Union-Find)
|
|
92
|
+
- Suffix Array & Suffix Tree
|
|
93
|
+
- Skip List
|
|
94
|
+
|
|
95
|
+
## 🚀 Installation
|
|
96
|
+
|
|
97
|
+
Add this line to your application's Gemfile:
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
gem 'dsa_visualizer'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
And then execute:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
bundle install
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Or install it yourself as:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
gem install dsa_visualizer
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 💻 Usage
|
|
116
|
+
|
|
117
|
+
### Interactive CLI (Recommended)
|
|
118
|
+
|
|
119
|
+
Start the interactive learning interface:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
ruby -Ilib bin/dsa_visualizer
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Or in your Ruby code:
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
require 'dsa_visualizer'
|
|
129
|
+
|
|
130
|
+
DSAVisualizer.start_cli
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
This launches an interactive menu where you can:
|
|
134
|
+
- Navigate through 12 sections of DSA topics
|
|
135
|
+
- Select specific topics by number (e.g., "2.1" for Arrays)
|
|
136
|
+
- Track your learning progress
|
|
137
|
+
- View saved notes
|
|
138
|
+
|
|
139
|
+
### Direct Topic Access
|
|
140
|
+
|
|
141
|
+
Learn specific topics programmatically:
|
|
142
|
+
|
|
143
|
+
```ruby
|
|
144
|
+
require 'dsa_visualizer'
|
|
145
|
+
|
|
146
|
+
# Fundamentals
|
|
147
|
+
DSAVisualizer.learn(:complexity_basics)
|
|
148
|
+
DSAVisualizer.learn(:memory_basics)
|
|
149
|
+
DSAVisualizer.learn(:pointers_basics)
|
|
150
|
+
DSAVisualizer.learn(:recursion_basics)
|
|
151
|
+
|
|
152
|
+
# Data Structures
|
|
153
|
+
DSAVisualizer.learn(:array)
|
|
154
|
+
DSAVisualizer.learn(:linked_list)
|
|
155
|
+
DSAVisualizer.learn(:stack)
|
|
156
|
+
DSAVisualizer.learn(:queue)
|
|
157
|
+
DSAVisualizer.learn(:hash_table)
|
|
158
|
+
DSAVisualizer.learn(:binary_tree)
|
|
159
|
+
DSAVisualizer.learn(:bst)
|
|
160
|
+
|
|
161
|
+
# Algorithms
|
|
162
|
+
DSAVisualizer.learn(:bubble_sort)
|
|
163
|
+
DSAVisualizer.learn(:binary_search)
|
|
164
|
+
DSAVisualizer.learn(:bfs)
|
|
165
|
+
DSAVisualizer.learn(:dfs)
|
|
166
|
+
DSAVisualizer.learn(:dijkstra)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 📖 Example Output
|
|
170
|
+
|
|
171
|
+
When you run `DSAVisualizer.learn(:complexity_basics)`:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
================================================================================
|
|
175
|
+
TIME & SPACE COMPLEXITY - Foundation of Algorithm Analysis
|
|
176
|
+
================================================================================
|
|
177
|
+
|
|
178
|
+
📖 WHAT IS COMPLEXITY ANALYSIS?
|
|
179
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
180
|
+
Complexity analysis helps us understand how an algorithm's performance
|
|
181
|
+
scales with input size. We measure two things:
|
|
182
|
+
1. Time Complexity - How execution time grows
|
|
183
|
+
2. Space Complexity - How memory usage grows
|
|
184
|
+
|
|
185
|
+
1. Big O Notation
|
|
186
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
187
|
+
|
|
188
|
+
Big O describes the upper bound (worst case) of algorithm growth.
|
|
189
|
+
|
|
190
|
+
Common Time Complexities (from best to worst):
|
|
191
|
+
O(1) Constant → Array access, hash lookup
|
|
192
|
+
O(log n) Logarithmic → Binary search, balanced tree ops
|
|
193
|
+
O(n) Linear → Array traversal, linear search
|
|
194
|
+
O(n log n) Linearithmic → Merge sort, quick sort (avg)
|
|
195
|
+
O(n²) Quadratic → Bubble sort, nested loops
|
|
196
|
+
...
|
|
197
|
+
|
|
198
|
+
[Detailed examples with Ruby and C++ code comparisons follow]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## 🎓 Learning Path
|
|
202
|
+
|
|
203
|
+
### For Beginners (Start Here!)
|
|
204
|
+
1. Start with **Fundamentals** (Section 1)
|
|
205
|
+
- Understand complexity analysis first
|
|
206
|
+
- Learn memory management basics
|
|
207
|
+
- Master pointers/references concept
|
|
208
|
+
- Practice recursion
|
|
209
|
+
|
|
210
|
+
2. Move to **Basic Data Structures** (Section 2)
|
|
211
|
+
- Arrays and Strings
|
|
212
|
+
- Linked Lists
|
|
213
|
+
|
|
214
|
+
3. Learn **Stack & Queue** (Section 3)
|
|
215
|
+
|
|
216
|
+
### Intermediate Level
|
|
217
|
+
4. **Hashing** (Section 4)
|
|
218
|
+
5. **Trees** (Section 5)
|
|
219
|
+
6. **Heaps** (Section 6)
|
|
220
|
+
7. **Sorting & Searching** (Sections 8-9)
|
|
221
|
+
|
|
222
|
+
### Advanced Level
|
|
223
|
+
8. **Graphs** (Section 7)
|
|
224
|
+
9. **Advanced Algorithms** (Section 10)
|
|
225
|
+
10. **String Algorithms** (Section 11)
|
|
226
|
+
11. **Advanced Data Structures** (Section 12)
|
|
227
|
+
|
|
228
|
+
## 🎯 What Makes This Gem Special?
|
|
229
|
+
|
|
230
|
+
1. **Zero to Hero Approach**: Complete curriculum from basics to advanced
|
|
231
|
+
2. **Core Level Understanding**: Shows what happens in memory, not just theory
|
|
232
|
+
3. **Language Comparison**: Learn by comparing Ruby's abstractions with C++'s control
|
|
233
|
+
4. **Visual Learning**: ASCII visualizations make abstract concepts concrete
|
|
234
|
+
5. **Step-by-Step**: Track each operation with detailed explanations
|
|
235
|
+
6. **Comprehensive Notes**: Important points, common mistakes, best practices
|
|
236
|
+
7. **Practice Problems**: Curated problems for each topic
|
|
237
|
+
8. **Progress Tracking**: See your learning journey
|
|
238
|
+
9. **Real-World Context**: Understand when and why to use each structure
|
|
239
|
+
10. **Interactive CLI**: Easy navigation through topics
|
|
240
|
+
|
|
241
|
+
## 📝 Each Topic Includes
|
|
242
|
+
|
|
243
|
+
- ✅ Concept explanation
|
|
244
|
+
- ✅ Ruby implementation with code
|
|
245
|
+
- ✅ C++ implementation with code
|
|
246
|
+
- ✅ Side-by-side comparison
|
|
247
|
+
- ✅ Memory layout visualization
|
|
248
|
+
- ✅ Time complexity analysis
|
|
249
|
+
- ✅ Space complexity analysis
|
|
250
|
+
- ✅ Step-by-step operation walkthrough
|
|
251
|
+
- ✅ Important notes and key points
|
|
252
|
+
- ✅ When to use / when not to use
|
|
253
|
+
- ✅ Real-world applications
|
|
254
|
+
- ✅ Common mistakes to avoid
|
|
255
|
+
- ✅ Practice problems
|
|
256
|
+
|
|
257
|
+
## 🛠️ Requirements
|
|
258
|
+
|
|
259
|
+
- Ruby >= 2.7.0
|
|
260
|
+
- colorize gem (for colored output)
|
|
261
|
+
- tty-box gem (for visual boxes)
|
|
262
|
+
- tty-table gem (for tables)
|
|
263
|
+
|
|
264
|
+
## 🔧 Development
|
|
265
|
+
|
|
266
|
+
After checking out the repo, run:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
bundle install
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
To run the interactive CLI:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
ruby -Ilib bin/dsa_visualizer
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
To run a specific topic:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
ruby -Ilib -r dsa_visualizer -e "DSAVisualizer.learn(:array)"
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## 🤝 Contributing
|
|
285
|
+
|
|
286
|
+
Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration.
|
|
287
|
+
|
|
288
|
+
## 📄 License
|
|
289
|
+
|
|
290
|
+
The gem is available as open source under the terms of the MIT License.
|
|
291
|
+
|
|
292
|
+
## 🗺️ Roadmap
|
|
293
|
+
|
|
294
|
+
- [x] Core fundamentals (Complexity, Memory, Pointers, Recursion)
|
|
295
|
+
- [x] Basic data structures (Array, Linked List, Stack, Queue)
|
|
296
|
+
- [x] Interactive CLI with progress tracking
|
|
297
|
+
- [ ] Complete all tree implementations
|
|
298
|
+
- [ ] Complete all graph algorithms
|
|
299
|
+
- [ ] Complete all sorting algorithms
|
|
300
|
+
- [ ] Add dynamic programming examples
|
|
301
|
+
- [ ] Add more practice problems
|
|
302
|
+
- [ ] Add quiz mode
|
|
303
|
+
- [ ] Export notes to PDF
|
|
304
|
+
- [ ] Web interface
|
|
305
|
+
- [ ] Video tutorials integration
|
|
306
|
+
|
|
307
|
+
## 💡 Tips for Learning
|
|
308
|
+
|
|
309
|
+
1. **Follow the order**: Start with fundamentals, don't skip ahead
|
|
310
|
+
2. **Practice coding**: Don't just read, implement the structures yourself
|
|
311
|
+
3. **Understand, don't memorize**: Focus on why, not just how
|
|
312
|
+
4. **Compare languages**: See how Ruby and C++ approach the same problem
|
|
313
|
+
5. **Solve practice problems**: Apply what you learn
|
|
314
|
+
6. **Track progress**: Use the built-in progress tracker
|
|
315
|
+
7. **Review notes**: Revisit important points regularly
|
|
316
|
+
|
|
317
|
+
## 🙏 Credits
|
|
318
|
+
|
|
319
|
+
Created for developers who want to truly understand data structures and algorithms at a fundamental level, with practical comparisons between high-level (Ruby) and low-level (C++) implementations.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
**Happy Learning! 🚀 Master DSA one topic at a time!**
|
data/USAGE.md
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
# DSA Visualizer - Complete Usage Guide
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
1. [Getting Started](#getting-started)
|
|
5
|
+
2. [Interactive CLI](#interactive-cli)
|
|
6
|
+
3. [Topic Navigation](#topic-navigation)
|
|
7
|
+
4. [Understanding Output](#understanding-output)
|
|
8
|
+
5. [Progress Tracking](#progress-tracking)
|
|
9
|
+
6. [Learning Tips](#learning-tips)
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
### Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
gem install dsa_visualizer
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or add to your Gemfile:
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
gem 'dsa_visualizer'
|
|
23
|
+
bundle install
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### First Run
|
|
27
|
+
|
|
28
|
+
Start the interactive CLI:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
ruby -Ilib bin/dsa_visualizer
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You'll see the main menu with all 12 sections of the curriculum.
|
|
35
|
+
|
|
36
|
+
## Interactive CLI
|
|
37
|
+
|
|
38
|
+
### Main Menu
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
42
|
+
║ DSA VISUALIZER - Zero to Hero ║
|
|
43
|
+
║ Ruby vs C++ Implementation Comparison ║
|
|
44
|
+
╚══════════════════════════════════════════════════════════════════════════════╝
|
|
45
|
+
|
|
46
|
+
📚 CURRICULUM
|
|
47
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
1. Fundamentals
|
|
50
|
+
1.1. Time & Space Complexity
|
|
51
|
+
1.2. Memory Management
|
|
52
|
+
1.3. Pointers & References
|
|
53
|
+
1.4. Recursion Basics
|
|
54
|
+
|
|
55
|
+
2. Basic Data Structures
|
|
56
|
+
2.1. Arrays
|
|
57
|
+
2.2. Strings
|
|
58
|
+
2.3. Linked Lists
|
|
59
|
+
...
|
|
60
|
+
|
|
61
|
+
Commands:
|
|
62
|
+
• Enter topic number (e.g., 2.1 for Arrays)
|
|
63
|
+
• Type 'progress' to see your learning progress
|
|
64
|
+
• Type 'notes' to view saved notes
|
|
65
|
+
• Type '0' to exit
|
|
66
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
➤ Enter your choice:
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Navigation Commands
|
|
72
|
+
|
|
73
|
+
- **Topic Number** (e.g., `1.1`, `2.1`): Learn specific topic
|
|
74
|
+
- **`progress`**: View your learning progress
|
|
75
|
+
- **`notes`**: View saved notes (coming soon)
|
|
76
|
+
- **`0`**: Exit the program
|
|
77
|
+
|
|
78
|
+
## Topic Navigation
|
|
79
|
+
|
|
80
|
+
### Recommended Learning Path
|
|
81
|
+
|
|
82
|
+
#### Beginners (Week 1-2)
|
|
83
|
+
```
|
|
84
|
+
1.1 → 1.2 → 1.3 → 1.4 (Fundamentals)
|
|
85
|
+
2.1 → 2.2 → 2.3 (Basic Data Structures)
|
|
86
|
+
3.1 → 3.3 (Stack & Queue basics)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### Intermediate (Week 3-4)
|
|
90
|
+
```
|
|
91
|
+
4.1 → 4.2 → 4.3 (Hashing)
|
|
92
|
+
5.1 → 5.2 → 5.3 (Trees basics)
|
|
93
|
+
8.1 → 8.4 → 8.5 (Sorting)
|
|
94
|
+
9.1 → 9.2 (Searching)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### Advanced (Week 5-8)
|
|
98
|
+
```
|
|
99
|
+
6.1 → 6.2 (Heaps)
|
|
100
|
+
7.1 → 7.2 → 7.3 → 7.5 (Graphs)
|
|
101
|
+
10.1 → 10.2 → 10.3 (Dynamic Programming)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Direct Topic Access (Programmatic)
|
|
105
|
+
|
|
106
|
+
```ruby
|
|
107
|
+
require 'dsa_visualizer'
|
|
108
|
+
|
|
109
|
+
# Learn fundamentals
|
|
110
|
+
DSAVisualizer.learn(:complexity_basics)
|
|
111
|
+
DSAVisualizer.learn(:memory_basics)
|
|
112
|
+
DSAVisualizer.learn(:pointers_basics)
|
|
113
|
+
DSAVisualizer.learn(:recursion_basics)
|
|
114
|
+
|
|
115
|
+
# Learn data structures
|
|
116
|
+
DSAVisualizer.learn(:array)
|
|
117
|
+
DSAVisualizer.learn(:linked_list)
|
|
118
|
+
DSAVisualizer.learn(:stack)
|
|
119
|
+
DSAVisualizer.learn(:queue)
|
|
120
|
+
DSAVisualizer.learn(:hash_table)
|
|
121
|
+
DSAVisualizer.learn(:binary_tree)
|
|
122
|
+
|
|
123
|
+
# Learn algorithms
|
|
124
|
+
DSAVisualizer.learn(:bubble_sort)
|
|
125
|
+
DSAVisualizer.learn(:binary_search)
|
|
126
|
+
DSAVisualizer.learn(:bfs)
|
|
127
|
+
DSAVisualizer.learn(:dfs)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Understanding Output
|
|
131
|
+
|
|
132
|
+
Each topic provides comprehensive information in this structure:
|
|
133
|
+
|
|
134
|
+
### 1. Header
|
|
135
|
+
```
|
|
136
|
+
================================================================================
|
|
137
|
+
TOPIC NAME - Description
|
|
138
|
+
================================================================================
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 2. Introduction
|
|
142
|
+
- What is this concept?
|
|
143
|
+
- Why is it important?
|
|
144
|
+
- Where is it used?
|
|
145
|
+
|
|
146
|
+
### 3. Code Comparisons
|
|
147
|
+
```
|
|
148
|
+
┌─ Ruby Implementation ─────────────────────────────────────────────────────┐
|
|
149
|
+
│ Ruby code here │
|
|
150
|
+
└────────────────────────────────────────────────────────────────────────────┘
|
|
151
|
+
|
|
152
|
+
┌─ C++ Implementation ──────────────────────────────────────────────────────┐
|
|
153
|
+
│ C++ code here │
|
|
154
|
+
└────────────────────────────────────────────────────────────────────────────┘
|
|
155
|
+
|
|
156
|
+
💡 Core Difference:
|
|
157
|
+
Explanation of key differences
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 4. Visual Representations
|
|
161
|
+
- ASCII art diagrams
|
|
162
|
+
- Memory layouts
|
|
163
|
+
- Step-by-step operations
|
|
164
|
+
|
|
165
|
+
### 5. Complexity Analysis
|
|
166
|
+
```
|
|
167
|
+
⏱️ TIME COMPLEXITY SUMMARY
|
|
168
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
169
|
+
Operation → Complexity
|
|
170
|
+
Access → O(1)
|
|
171
|
+
Search → O(n)
|
|
172
|
+
Insertion → O(n)
|
|
173
|
+
Deletion → O(n)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 6. Important Notes
|
|
177
|
+
```
|
|
178
|
+
📝 IMPORTANT NOTES - Topic Name
|
|
179
|
+
════════════════════════════════════════════════════════════════════════════════
|
|
180
|
+
1. First important point
|
|
181
|
+
2. Second important point
|
|
182
|
+
...
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### 7. Key Points
|
|
186
|
+
```
|
|
187
|
+
🎯 KEY POINTS TO REMEMBER
|
|
188
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
189
|
+
✓ Key point 1
|
|
190
|
+
✓ Key point 2
|
|
191
|
+
...
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 8. When to Use
|
|
195
|
+
```
|
|
196
|
+
✅ WHEN TO USE
|
|
197
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
198
|
+
✓ Use case 1
|
|
199
|
+
✓ Use case 2
|
|
200
|
+
...
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 9. Common Mistakes
|
|
204
|
+
```
|
|
205
|
+
⚠️ COMMON MISTAKES TO AVOID
|
|
206
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
207
|
+
⚠ Mistake 1
|
|
208
|
+
⚠ Mistake 2
|
|
209
|
+
...
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### 10. Practice Problems
|
|
213
|
+
```
|
|
214
|
+
💪 PRACTICE PROBLEMS
|
|
215
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
216
|
+
1. Problem Title [Difficulty]
|
|
217
|
+
Description
|
|
218
|
+
...
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Progress Tracking
|
|
222
|
+
|
|
223
|
+
### View Progress
|
|
224
|
+
|
|
225
|
+
Type `progress` in the CLI to see:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
📊 YOUR LEARNING PROGRESS
|
|
229
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
230
|
+
|
|
231
|
+
Completed: 5/50 topics
|
|
232
|
+
Progress: ██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 10%
|
|
233
|
+
|
|
234
|
+
✅ Completed Topics:
|
|
235
|
+
• 1.1 - Time & Space Complexity
|
|
236
|
+
• 1.2 - Memory Management
|
|
237
|
+
• 2.1 - Arrays
|
|
238
|
+
• 2.3 - Linked Lists
|
|
239
|
+
• 3.1 - Stack
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Progress is automatically saved to `~/.dsa_visualizer_progress`
|
|
243
|
+
|
|
244
|
+
## Learning Tips
|
|
245
|
+
|
|
246
|
+
### 1. Start with Fundamentals
|
|
247
|
+
Don't skip section 1! Understanding complexity, memory, and pointers is crucial.
|
|
248
|
+
|
|
249
|
+
### 2. Code Along
|
|
250
|
+
Don't just read - implement the structures yourself:
|
|
251
|
+
|
|
252
|
+
```ruby
|
|
253
|
+
# After learning linked lists, implement it:
|
|
254
|
+
class Node
|
|
255
|
+
attr_accessor :data, :next
|
|
256
|
+
def initialize(data)
|
|
257
|
+
@data = data
|
|
258
|
+
@next = nil
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# Test your implementation
|
|
263
|
+
head = Node.new(10)
|
|
264
|
+
head.next = Node.new(20)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### 3. Compare Languages
|
|
268
|
+
Pay attention to Ruby vs C++ differences:
|
|
269
|
+
- Ruby: High-level, automatic memory management
|
|
270
|
+
- C++: Low-level, manual control, better performance
|
|
271
|
+
|
|
272
|
+
### 4. Visualize
|
|
273
|
+
Draw the structures on paper as you learn:
|
|
274
|
+
```
|
|
275
|
+
Array: [1][2][3][4][5] ← Contiguous
|
|
276
|
+
|
|
277
|
+
Linked List: [1]→[2]→[3]→[4]→nil ← Scattered
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### 5. Practice Problems
|
|
281
|
+
After each topic, solve the practice problems provided.
|
|
282
|
+
|
|
283
|
+
### 6. Review Notes
|
|
284
|
+
Revisit "Important Notes" and "Key Points" sections regularly.
|
|
285
|
+
|
|
286
|
+
### 7. Understand Trade-offs
|
|
287
|
+
Every data structure has pros and cons. Learn when to use what.
|
|
288
|
+
|
|
289
|
+
### 8. Track Progress
|
|
290
|
+
Use the progress tracker to stay motivated and see your journey.
|
|
291
|
+
|
|
292
|
+
## Advanced Usage
|
|
293
|
+
|
|
294
|
+
### Custom Learning Path
|
|
295
|
+
|
|
296
|
+
Create your own learning script:
|
|
297
|
+
|
|
298
|
+
```ruby
|
|
299
|
+
require 'dsa_visualizer'
|
|
300
|
+
|
|
301
|
+
# Focus on trees
|
|
302
|
+
topics = [:binary_tree, :bst, :heap]
|
|
303
|
+
topics.each do |topic|
|
|
304
|
+
DSAVisualizer.learn(topic)
|
|
305
|
+
puts "\n\nPress Enter to continue..."
|
|
306
|
+
gets
|
|
307
|
+
end
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Integration with Your Code
|
|
311
|
+
|
|
312
|
+
```ruby
|
|
313
|
+
require 'dsa_visualizer'
|
|
314
|
+
|
|
315
|
+
# Learn before implementing
|
|
316
|
+
DSAVisualizer.learn(:hash_table)
|
|
317
|
+
|
|
318
|
+
# Then implement your own
|
|
319
|
+
class MyHashTable
|
|
320
|
+
# Your implementation
|
|
321
|
+
end
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Troubleshooting
|
|
325
|
+
|
|
326
|
+
### Colors Not Showing
|
|
327
|
+
Install colorize gem:
|
|
328
|
+
```bash
|
|
329
|
+
gem install colorize
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### CLI Not Starting
|
|
333
|
+
Make sure you're in the gem directory:
|
|
334
|
+
```bash
|
|
335
|
+
cd path/to/dsa_visualizer
|
|
336
|
+
ruby -Ilib bin/dsa_visualizer
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Topic Not Found
|
|
340
|
+
Check the topic key in the main menu. Use exact format (e.g., `2.1` not `2-1`).
|
|
341
|
+
|
|
342
|
+
## Next Steps
|
|
343
|
+
|
|
344
|
+
1. Complete all fundamentals (Section 1)
|
|
345
|
+
2. Master basic data structures (Sections 2-3)
|
|
346
|
+
3. Learn hashing and trees (Sections 4-5)
|
|
347
|
+
4. Study algorithms (Sections 8-9)
|
|
348
|
+
5. Tackle advanced topics (Sections 10-12)
|
|
349
|
+
|
|
350
|
+
## Support
|
|
351
|
+
|
|
352
|
+
For issues or questions:
|
|
353
|
+
- Check the README.md
|
|
354
|
+
- Review this USAGE.md
|
|
355
|
+
- Open an issue on GitHub
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
**Happy Learning! Master DSA one topic at a time! 🚀**
|