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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import json
|
| 3 |
+
from typing import Dict, List, Tuple, Set
|
| 4 |
+
|
| 5 |
+
class DSALearningRoadmap:
|
| 6 |
+
def __init__(self):
|
| 7 |
+
self.topics_data = {
|
| 8 |
+
"Arrays": {
|
| 9 |
+
"difficulty": "Beginner",
|
| 10 |
+
"prerequisites": [],
|
| 11 |
+
"description": "Linear data structure storing elements in contiguous memory locations",
|
| 12 |
+
"key_concepts": ["Indexing", "Traversal", "Insertion", "Deletion", "Searching"],
|
| 13 |
+
"learning_path": [
|
| 14 |
+
"Understand array basics and memory layout",
|
| 15 |
+
"Learn array operations (CRUD)",
|
| 16 |
+
"Practice basic array problems",
|
| 17 |
+
"Master array traversal patterns",
|
| 18 |
+
"Solve sliding window problems"
|
| 19 |
+
],
|
| 20 |
+
"time_estimate": "1-2 weeks",
|
| 21 |
+
"connects_to": ["Strings", "Sorting", "Searching", "Dynamic Programming", "Two Pointers"],
|
| 22 |
+
"important_problems": [
|
| 23 |
+
"Two Sum", "Maximum Subarray", "Rotate Array", "Merge Sorted Arrays", "Find Duplicates"
|
| 24 |
+
]
|
| 25 |
+
},
|
| 26 |
+
"Strings": {
|
| 27 |
+
"difficulty": "Beginner",
|
| 28 |
+
"prerequisites": ["Arrays"],
|
| 29 |
+
"description": "Sequence of characters, often implemented as character arrays",
|
| 30 |
+
"key_concepts": ["String manipulation", "Pattern matching", "Substring operations", "String comparison"],
|
| 31 |
+
"learning_path": [
|
| 32 |
+
"Learn string basics and operations",
|
| 33 |
+
"Practice string manipulation problems",
|
| 34 |
+
"Master substring and pattern matching",
|
| 35 |
+
"Learn string algorithms (KMP, Rabin-Karp)",
|
| 36 |
+
"Solve advanced string problems"
|
| 37 |
+
],
|
| 38 |
+
"time_estimate": "2-3 weeks",
|
| 39 |
+
"connects_to": ["Arrays", "Hashing", "Tries", "Dynamic Programming"],
|
| 40 |
+
"important_problems": [
|
| 41 |
+
"Valid Palindrome", "Longest Substring Without Repeating Characters", "Group Anagrams", "String to Integer", "Implement strStr()"
|
| 42 |
+
]
|
| 43 |
+
},
|
| 44 |
+
"Linked Lists": {
|
| 45 |
+
"difficulty": "Beginner",
|
| 46 |
+
"prerequisites": ["Arrays"],
|
| 47 |
+
"description": "Linear data structure where elements are stored in nodes connected via pointers",
|
| 48 |
+
"key_concepts": ["Pointers", "Node operations", "Traversal", "Insertion", "Deletion"],
|
| 49 |
+
"learning_path": [
|
| 50 |
+
"Understand pointers and node structure",
|
| 51 |
+
"Learn basic linked list operations",
|
| 52 |
+
"Practice traversal and manipulation",
|
| 53 |
+
"Master different types (singly, doubly, circular)",
|
| 54 |
+
"Solve complex linked list problems"
|
| 55 |
+
],
|
| 56 |
+
"time_estimate": "2-3 weeks",
|
| 57 |
+
"connects_to": ["Stacks", "Queues", "Trees", "Graphs", "Hashing"],
|
| 58 |
+
"important_problems": [
|
| 59 |
+
"Reverse Linked List", "Merge Two Sorted Lists", "Detect Cycle", "Remove Nth Node", "Intersection of Two Linked Lists"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"Stacks": {
|
| 63 |
+
"difficulty": "Beginner",
|
| 64 |
+
"prerequisites": ["Arrays", "Linked Lists"],
|
| 65 |
+
"description": "LIFO (Last In First Out) data structure",
|
| 66 |
+
"key_concepts": ["Push", "Pop", "Peek", "Stack overflow", "Applications"],
|
| 67 |
+
"learning_path": [
|
| 68 |
+
"Learn stack concept and operations",
|
| 69 |
+
"Implement stack using arrays and linked lists",
|
| 70 |
+
"Practice basic stack problems",
|
| 71 |
+
"Learn stack applications (expression evaluation, parsing)",
|
| 72 |
+
"Master advanced stack problems"
|
| 73 |
+
],
|
| 74 |
+
"time_estimate": "1-2 weeks",
|
| 75 |
+
"connects_to": ["Queues", "Recursion", "Trees", "Graphs", "Dynamic Programming"],
|
| 76 |
+
"important_problems": [
|
| 77 |
+
"Valid Parentheses", "Min Stack", "Evaluate Reverse Polish Notation", "Largest Rectangle in Histogram", "Daily Temperatures"
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
"Queues": {
|
| 81 |
+
"difficulty": "Beginner",
|
| 82 |
+
"prerequisites": ["Arrays", "Linked Lists"],
|
| 83 |
+
"description": "FIFO (First In First Out) data structure",
|
| 84 |
+
"key_concepts": ["Enqueue", "Dequeue", "Front", "Rear", "Circular queue"],
|
| 85 |
+
"learning_path": [
|
| 86 |
+
"Learn queue concept and operations",
|
| 87 |
+
"Implement queue using arrays and linked lists",
|
| 88 |
+
"Practice basic queue problems",
|
| 89 |
+
"Learn different types (circular, priority, deque)",
|
| 90 |
+
"Master BFS and queue applications"
|
| 91 |
+
],
|
| 92 |
+
"time_estimate": "1-2 weeks",
|
| 93 |
+
"connects_to": ["Stacks", "Trees", "Graphs", "BFS", "Priority Queues"],
|
| 94 |
+
"important_problems": [
|
| 95 |
+
"Implement Queue using Stacks", "Sliding Window Maximum", "Design Circular Queue", "Rotting Oranges", "First Unique Character"
|
| 96 |
+
]
|
| 97 |
+
},
|
| 98 |
+
"Recursion": {
|
| 99 |
+
"difficulty": "Intermediate",
|
| 100 |
+
"prerequisites": ["Arrays", "Stacks"],
|
| 101 |
+
"description": "Problem-solving technique where a function calls itself",
|
| 102 |
+
"key_concepts": ["Base case", "Recursive case", "Call stack", "Memoization", "Tail recursion"],
|
| 103 |
+
"learning_path": [
|
| 104 |
+
"Understand recursion concept and base cases",
|
| 105 |
+
"Practice simple recursive problems",
|
| 106 |
+
"Learn recursive patterns and techniques",
|
| 107 |
+
"Master backtracking using recursion",
|
| 108 |
+
"Optimize recursive solutions"
|
| 109 |
+
],
|
| 110 |
+
"time_estimate": "2-3 weeks",
|
| 111 |
+
"connects_to": ["Dynamic Programming", "Trees", "Graphs", "Backtracking", "Divide and Conquer"],
|
| 112 |
+
"important_problems": [
|
| 113 |
+
"Fibonacci Sequence", "Factorial", "Tower of Hanoi", "Generate Parentheses", "Permutations"
|
| 114 |
+
]
|
| 115 |
+
},
|
| 116 |
+
"Sorting": {
|
| 117 |
+
"difficulty": "Intermediate",
|
| 118 |
+
"prerequisites": ["Arrays", "Recursion"],
|
| 119 |
+
"description": "Algorithms to arrange elements in a specific order",
|
| 120 |
+
"key_concepts": ["Comparison sorting", "Time complexity", "Space complexity", "Stability", "In-place sorting"],
|
| 121 |
+
"learning_path": [
|
| 122 |
+
"Learn basic sorting algorithms (bubble, selection, insertion)",
|
| 123 |
+
"Master efficient sorting algorithms (merge, quick, heap)",
|
| 124 |
+
"Understand time and space complexity analysis",
|
| 125 |
+
"Practice sorting-based problems",
|
| 126 |
+
"Learn specialized sorting techniques"
|
| 127 |
+
],
|
| 128 |
+
"time_estimate": "2-3 weeks",
|
| 129 |
+
"connects_to": ["Arrays", "Divide and Conquer", "Heaps", "Searching", "Trees"],
|
| 130 |
+
"important_problems": [
|
| 131 |
+
"Merge Intervals", "Sort Colors", "Kth Largest Element", "Meeting Rooms", "Largest Number"
|
| 132 |
+
]
|
| 133 |
+
},
|
| 134 |
+
"Searching": {
|
| 135 |
+
"difficulty": "Intermediate",
|
| 136 |
+
"prerequisites": ["Arrays", "Recursion", "Sorting"],
|
| 137 |
+
"description": "Algorithms to find specific elements in data structures",
|
| 138 |
+
"key_concepts": ["Linear search", "Binary search", "Search space", "Invariants", "Applications"],
|
| 139 |
+
"learning_path": [
|
| 140 |
+
"Learn linear search and its applications",
|
| 141 |
+
"Master binary search and its variants",
|
| 142 |
+
"Practice search in rotated/modified arrays",
|
| 143 |
+
"Learn search in 2D arrays and matrices",
|
| 144 |
+
"Solve complex search problems"
|
| 145 |
+
],
|
| 146 |
+
"time_estimate": "2-3 weeks",
|
| 147 |
+
"connects_to": ["Arrays", "Sorting", "Trees", "Graphs", "Two Pointers"],
|
| 148 |
+
"important_problems": [
|
| 149 |
+
"Binary Search", "Find First and Last Position", "Search in Rotated Array", "Find Peak Element", "Search 2D Matrix"
|
| 150 |
+
]
|
| 151 |
+
},
|
| 152 |
+
"Trees": {
|
| 153 |
+
"difficulty": "Intermediate",
|
| 154 |
+
"prerequisites": ["Linked Lists", "Recursion", "Stacks", "Queues"],
|
| 155 |
+
"description": "Hierarchical data structure with nodes connected by edges",
|
| 156 |
+
"key_concepts": ["Root", "Leaves", "Height", "Depth", "Traversals", "Binary trees"],
|
| 157 |
+
"learning_path": [
|
| 158 |
+
"Learn tree terminology and concepts",
|
| 159 |
+
"Master tree traversals (inorder, preorder, postorder)",
|
| 160 |
+
"Practice binary tree problems",
|
| 161 |
+
"Learn binary search trees (BST)",
|
| 162 |
+
"Solve advanced tree problems"
|
| 163 |
+
],
|
| 164 |
+
"time_estimate": "3-4 weeks",
|
| 165 |
+
"connects_to": ["Graphs", "Heaps", "Tries", "Dynamic Programming", "DFS", "BFS"],
|
| 166 |
+
"important_problems": [
|
| 167 |
+
"Maximum Depth of Binary Tree", "Validate Binary Search Tree", "Lowest Common Ancestor", "Binary Tree Level Order Traversal", "Serialize and Deserialize Binary Tree"
|
| 168 |
+
]
|
| 169 |
+
},
|
| 170 |
+
"Graphs": {
|
| 171 |
+
"difficulty": "Advanced",
|
| 172 |
+
"prerequisites": ["Trees", "Queues", "Stacks", "Recursion"],
|
| 173 |
+
"description": "Non-linear data structure consisting of vertices and edges",
|
| 174 |
+
"key_concepts": ["Vertices", "Edges", "Directed/Undirected", "Weighted/Unweighted", "Representation"],
|
| 175 |
+
"learning_path": [
|
| 176 |
+
"Learn graph terminology and representation",
|
| 177 |
+
"Master graph traversals (DFS, BFS)",
|
| 178 |
+
"Practice basic graph problems",
|
| 179 |
+
"Learn shortest path algorithms",
|
| 180 |
+
"Solve complex graph problems"
|
| 181 |
+
],
|
| 182 |
+
"time_estimate": "4-5 weeks",
|
| 183 |
+
"connects_to": ["Trees", "DFS", "BFS", "Dynamic Programming", "Greedy Algorithms"],
|
| 184 |
+
"important_problems": [
|
| 185 |
+
"Clone Graph", "Number of Islands", "Course Schedule", "Shortest Path in Binary Matrix", "Word Ladder"
|
| 186 |
+
]
|
| 187 |
+
},
|
| 188 |
+
"Dynamic Programming": {
|
| 189 |
+
"difficulty": "Advanced",
|
| 190 |
+
"prerequisites": ["Arrays", "Recursion", "Trees"],
|
| 191 |
+
"description": "Optimization technique using memoization to solve overlapping subproblems",
|
| 192 |
+
"key_concepts": ["Optimal substructure", "Overlapping subproblems", "Memoization", "Tabulation", "State transitions"],
|
| 193 |
+
"learning_path": [
|
| 194 |
+
"Understand DP concepts and when to use",
|
| 195 |
+
"Learn basic DP patterns (fibonacci, climbing stairs)",
|
| 196 |
+
"Practice 1D DP problems",
|
| 197 |
+
"Master 2D DP problems",
|
| 198 |
+
"Solve complex DP problems"
|
| 199 |
+
],
|
| 200 |
+
"time_estimate": "4-6 weeks",
|
| 201 |
+
"connects_to": ["Arrays", "Strings", "Trees", "Graphs", "Greedy Algorithms"],
|
| 202 |
+
"important_problems": [
|
| 203 |
+
"Climbing Stairs", "House Robber", "Coin Change", "Longest Common Subsequence", "Edit Distance"
|
| 204 |
+
]
|
| 205 |
+
},
|
| 206 |
+
"Hashing": {
|
| 207 |
+
"difficulty": "Intermediate",
|
| 208 |
+
"prerequisites": ["Arrays", "Strings"],
|
| 209 |
+
"description": "Technique for fast data retrieval using hash functions",
|
| 210 |
+
"key_concepts": ["Hash functions", "Hash tables", "Collision resolution", "Load factor", "Applications"],
|
| 211 |
+
"learning_path": [
|
| 212 |
+
"Learn hash function concepts",
|
| 213 |
+
"Understand hash table implementation",
|
| 214 |
+
"Practice basic hashing problems",
|
| 215 |
+
"Learn collision resolution techniques",
|
| 216 |
+
"Master advanced hashing applications"
|
| 217 |
+
],
|
| 218 |
+
"time_estimate": "2-3 weeks",
|
| 219 |
+
"connects_to": ["Arrays", "Strings", "Sets", "Maps", "Caching"],
|
| 220 |
+
"important_problems": [
|
| 221 |
+
"Two Sum", "Group Anagrams", "First Non-Repeating Character", "Longest Substring Without Repeating Characters", "Design HashSet"
|
| 222 |
+
]
|
| 223 |
+
},
|
| 224 |
+
"Heaps": {
|
| 225 |
+
"difficulty": "Advanced",
|
| 226 |
+
"prerequisites": ["Trees", "Arrays", "Sorting"],
|
| 227 |
+
"description": "Complete binary tree with heap property (min-heap or max-heap)",
|
| 228 |
+
"key_concepts": ["Heap property", "Heapify", "Priority queue", "Heap operations", "Applications"],
|
| 229 |
+
"learning_path": [
|
| 230 |
+
"Learn heap concepts and properties",
|
| 231 |
+
"Implement heap operations",
|
| 232 |
+
"Practice basic heap problems",
|
| 233 |
+
"Master priority queue applications",
|
| 234 |
+
"Solve complex heap problems"
|
| 235 |
+
],
|
| 236 |
+
"time_estimate": "2-3 weeks",
|
| 237 |
+
"connects_to": ["Trees", "Sorting", "Graphs", "Greedy Algorithms", "Priority Queues"],
|
| 238 |
+
"important_problems": [
|
| 239 |
+
"Kth Largest Element", "Merge K Sorted Lists", "Top K Frequent Elements", "Find Median from Data Stream", "Task Scheduler"
|
| 240 |
+
]
|
| 241 |
+
},
|
| 242 |
+
"Tries": {
|
| 243 |
+
"difficulty": "Advanced",
|
| 244 |
+
"prerequisites": ["Trees", "Strings"],
|
| 245 |
+
"description": "Tree-like data structure for storing strings efficiently",
|
| 246 |
+
"key_concepts": ["Prefix tree", "Autocomplete", "Word search", "Memory optimization", "Applications"],
|
| 247 |
+
"learning_path": [
|
| 248 |
+
"Learn trie structure and operations",
|
| 249 |
+
"Implement basic trie functionality",
|
| 250 |
+
"Practice word-based problems",
|
| 251 |
+
"Master prefix matching applications",
|
| 252 |
+
"Solve complex trie problems"
|
| 253 |
+
],
|
| 254 |
+
"time_estimate": "2-3 weeks",
|
| 255 |
+
"connects_to": ["Trees", "Strings", "DFS", "Backtracking"],
|
| 256 |
+
"important_problems": [
|
| 257 |
+
"Implement Trie", "Word Search II", "Design Add and Search Words", "Longest Word in Dictionary", "Replace Words"
|
| 258 |
+
]
|
| 259 |
+
},
|
| 260 |
+
"Two Pointers": {
|
| 261 |
+
"difficulty": "Intermediate",
|
| 262 |
+
"prerequisites": ["Arrays", "Strings", "Sorting"],
|
| 263 |
+
"description": "Technique using two pointers to solve problems efficiently",
|
| 264 |
+
"key_concepts": ["Left-right pointers", "Fast-slow pointers", "Sliding window", "Meet in middle", "Optimization"],
|
| 265 |
+
"learning_path": [
|
| 266 |
+
"Learn two-pointer technique basics",
|
| 267 |
+
"Practice left-right pointer problems",
|
| 268 |
+
"Master fast-slow pointer technique",
|
| 269 |
+
"Learn sliding window applications",
|
| 270 |
+
"Solve complex two-pointer problems"
|
| 271 |
+
],
|
| 272 |
+
"time_estimate": "2-3 weeks",
|
| 273 |
+
"connects_to": ["Arrays", "Strings", "Linked Lists", "Sorting", "Searching"],
|
| 274 |
+
"important_problems": [
|
| 275 |
+
"Two Sum II", "3Sum", "Container With Most Water", "Trapping Rain Water", "Longest Substring Without Repeating Characters"
|
| 276 |
+
]
|
| 277 |
+
},
|
| 278 |
+
"Greedy Algorithms": {
|
| 279 |
+
"difficulty": "Advanced",
|
| 280 |
+
"prerequisites": ["Sorting", "Arrays", "Graphs"],
|
| 281 |
+
"description": "Problem-solving technique making locally optimal choices",
|
| 282 |
+
"key_concepts": ["Greedy choice", "Local optimization", "Proof techniques", "Activity selection", "Optimization"],
|
| 283 |
+
"learning_path": [
|
| 284 |
+
"Learn greedy algorithm concepts",
|
| 285 |
+
"Practice basic greedy problems",
|
| 286 |
+
"Master interval scheduling problems",
|
| 287 |
+
"Learn graph-based greedy algorithms",
|
| 288 |
+
"Solve complex greedy problems"
|
| 289 |
+
],
|
| 290 |
+
"time_estimate": "3-4 weeks",
|
| 291 |
+
"connects_to": ["Sorting", "Graphs", "Dynamic Programming", "Heaps"],
|
| 292 |
+
"important_problems": [
|
| 293 |
+
"Activity Selection", "Fractional Knapsack", "Minimum Spanning Tree", "Huffman Coding", "Gas Station"
|
| 294 |
+
]
|
| 295 |
+
},
|
| 296 |
+
"Backtracking": {
|
| 297 |
+
"difficulty": "Advanced",
|
| 298 |
+
"prerequisites": ["Recursion", "Trees", "Arrays"],
|
| 299 |
+
"description": "Algorithmic technique for finding solutions by exploring all possibilities",
|
| 300 |
+
"key_concepts": ["State space", "Pruning", "Constraint satisfaction", "Recursive exploration", "Optimization"],
|
| 301 |
+
"learning_path": [
|
| 302 |
+
"Learn backtracking concepts",
|
| 303 |
+
"Practice basic backtracking problems",
|
| 304 |
+
"Master constraint satisfaction problems",
|
| 305 |
+
"Learn optimization techniques",
|
| 306 |
+
"Solve complex backtracking problems"
|
| 307 |
+
],
|
| 308 |
+
"time_estimate": "3-4 weeks",
|
| 309 |
+
"connects_to": ["Recursion", "Trees", "Graphs", "Dynamic Programming"],
|
| 310 |
+
"important_problems": [
|
| 311 |
+
"N-Queens", "Sudoku Solver", "Word Search", "Combination Sum", "Palindrome Partitioning"
|
| 312 |
+
]
|
| 313 |
+
},
|
| 314 |
+
"Divide and Conquer": {
|
| 315 |
+
"difficulty": "Advanced",
|
| 316 |
+
"prerequisites": ["Recursion", "Sorting", "Arrays"],
|
| 317 |
+
"description": "Problem-solving technique dividing problems into smaller subproblems",
|
| 318 |
+
"key_concepts": ["Divide", "Conquer", "Combine", "Recurrence relations", "Master theorem"],
|
| 319 |
+
"learning_path": [
|
| 320 |
+
"Learn divide and conquer concepts",
|
| 321 |
+
"Practice basic divide and conquer problems",
|
| 322 |
+
"Master sorting algorithms using D&C",
|
| 323 |
+
"Learn advanced applications",
|
| 324 |
+
"Analyze time complexity"
|
| 325 |
+
],
|
| 326 |
+
"time_estimate": "3-4 weeks",
|
| 327 |
+
"connects_to": ["Recursion", "Sorting", "Trees", "Dynamic Programming"],
|
| 328 |
+
"important_problems": [
|
| 329 |
+
"Merge Sort", "Quick Sort", "Maximum Subarray", "Closest Pair of Points", "Strassen's Matrix Multiplication"
|
| 330 |
+
]
|
| 331 |
+
}
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
def get_topic_roadmap(self, topic_name: str) -> str:
|
| 335 |
+
"""Generate detailed roadmap for a specific topic"""
|
| 336 |
+
if topic_name not in self.topics_data:
|
| 337 |
+
return "β Topic not found! Please select a valid topic."
|
| 338 |
+
|
| 339 |
+
topic = self.topics_data[topic_name]
|
| 340 |
+
|
| 341 |
+
# Build the roadmap string
|
| 342 |
+
roadmap = f"""
|
| 343 |
+
# π― {topic_name} Learning Roadmap
|
| 344 |
+
|
| 345 |
+
## π Overview
|
| 346 |
+
**Difficulty Level:** {topic['difficulty']}
|
| 347 |
+
**Estimated Time:** {topic['time_estimate']}
|
| 348 |
+
**Description:** {topic['description']}
|
| 349 |
+
|
| 350 |
+
## π Prerequisites
|
| 351 |
+
"""
|
| 352 |
+
|
| 353 |
+
if topic['prerequisites']:
|
| 354 |
+
roadmap += "**You should learn these topics first:**\n"
|
| 355 |
+
for prereq in topic['prerequisites']:
|
| 356 |
+
roadmap += f"β’ {prereq}\n"
|
| 357 |
+
else:
|
| 358 |
+
roadmap += "**Great news!** This is a foundational topic - no prerequisites needed! π\n"
|
| 359 |
+
|
| 360 |
+
roadmap += f"""
|
| 361 |
+
## πΊοΈ Learning Path
|
| 362 |
+
**Follow this step-by-step approach:**
|
| 363 |
+
|
| 364 |
+
"""
|
| 365 |
+
|
| 366 |
+
for i, step in enumerate(topic['learning_path'], 1):
|
| 367 |
+
roadmap += f"{i}. {step}\n"
|
| 368 |
+
|
| 369 |
+
roadmap += f"""
|
| 370 |
+
## π Key Concepts to Master
|
| 371 |
+
"""
|
| 372 |
+
for concept in topic['key_concepts']:
|
| 373 |
+
roadmap += f"β’ {concept}\n"
|
| 374 |
+
|
| 375 |
+
roadmap += f"""
|
| 376 |
+
## π‘ Important Problems to Practice
|
| 377 |
+
"""
|
| 378 |
+
for problem in topic['important_problems']:
|
| 379 |
+
roadmap += f"β’ {problem}\n"
|
| 380 |
+
|
| 381 |
+
roadmap += f"""
|
| 382 |
+
## π Connected Topics
|
| 383 |
+
**After mastering {topic_name}, you'll be ready for:**
|
| 384 |
+
"""
|
| 385 |
+
for connected in topic['connects_to']:
|
| 386 |
+
roadmap += f"β’ {connected}\n"
|
| 387 |
+
|
| 388 |
+
return roadmap
|
| 389 |
+
|
| 390 |
+
def get_prerequisites_chain(self, topic_name: str) -> str:
|
| 391 |
+
"""Get the complete prerequisite chain for a topic"""
|
| 392 |
+
if topic_name not in self.topics_data:
|
| 393 |
+
return "β Topic not found!"
|
| 394 |
+
|
| 395 |
+
visited = set()
|
| 396 |
+
chain = []
|
| 397 |
+
|
| 398 |
+
def dfs_prerequisites(topic):
|
| 399 |
+
if topic in visited or topic not in self.topics_data:
|
| 400 |
+
return
|
| 401 |
+
|
| 402 |
+
visited.add(topic)
|
| 403 |
+
|
| 404 |
+
# Add prerequisites first
|
| 405 |
+
for prereq in self.topics_data[topic]['prerequisites']:
|
| 406 |
+
dfs_prerequisites(prereq)
|
| 407 |
+
|
| 408 |
+
chain.append(topic)
|
| 409 |
+
|
| 410 |
+
dfs_prerequisites(topic_name)
|
| 411 |
+
|
| 412 |
+
if len(chain) <= 1:
|
| 413 |
+
return f"π **{topic_name}** is a foundational topic - you can start learning it right away!"
|
| 414 |
+
|
| 415 |
+
result = f"π **Complete Learning Path to Master {topic_name}:**\n\n"
|
| 416 |
+
|
| 417 |
+
for i, topic in enumerate(chain, 1):
|
| 418 |
+
difficulty = self.topics_data[topic]['difficulty']
|
| 419 |
+
time_est = self.topics_data[topic]['time_estimate']
|
| 420 |
+
|
| 421 |
+
if i == len(chain):
|
| 422 |
+
result += f"π― **{i}. {topic}** (Your Target!) \n"
|
| 423 |
+
else:
|
| 424 |
+
result += f"π **{i}. {topic}** \n"
|
| 425 |
+
|
| 426 |
+
result += f" *Difficulty: {difficulty} | Time: {time_est}*\n\n"
|
| 427 |
+
|
| 428 |
+
total_topics = len(chain)
|
| 429 |
+
result += f"**Total Topics to Cover:** {total_topics}\n"
|
| 430 |
+
result += f"**Estimated Total Time:** {self._estimate_total_time(chain)}\n"
|
| 431 |
+
|
| 432 |
+
return result
|
| 433 |
+
|
| 434 |
+
def _estimate_total_time(self, chain: List[str]) -> str:
|
| 435 |
+
"""Estimate total time needed for a chain of topics"""
|
| 436 |
+
total_weeks = 0
|
| 437 |
+
for topic in chain:
|
| 438 |
+
time_str = self.topics_data[topic]['time_estimate']
|
| 439 |
+
# Extract weeks from string like "2-3 weeks"
|
| 440 |
+
weeks = time_str.split()[0].split('-')
|
| 441 |
+
avg_weeks = (int(weeks[0]) + int(weeks[-1])) / 2
|
| 442 |
+
total_weeks += avg_weeks
|
| 443 |
+
|
| 444 |
+
return f"{int(total_weeks)} weeks"
|
| 445 |
+
|
| 446 |
+
def get_topic_connections(self, topic_name: str) -> str:
|
| 447 |
+
"""Show how a topic connects to other topics"""
|
| 448 |
+
if topic_name not in self.topics_data:
|
| 449 |
+
return "β Topic not found!"
|
| 450 |
+
|
| 451 |
+
topic = self.topics_data[topic_name]
|
| 452 |
+
|
| 453 |
+
result = f"π **Topic Interconnections for {topic_name}**\n\n"
|
| 454 |
+
|
| 455 |
+
# Prerequisites
|
| 456 |
+
result += "**π Prerequisites (Learn these first):**\n"
|
| 457 |
+
if topic['prerequisites']:
|
| 458 |
+
for prereq in topic['prerequisites']:
|
| 459 |
+
result += f"β’ {prereq}\n"
|
| 460 |
+
else:
|
| 461 |
+
result += "β’ None - This is a foundational topic! π\n"
|
| 462 |
+
|
| 463 |
+
# What connects to this topic
|
| 464 |
+
result += f"\n**β‘οΈ What {topic_name} enables:**\n"
|
| 465 |
+
for connected in topic['connects_to']:
|
| 466 |
+
result += f"β’ {connected}\n"
|
| 467 |
+
|
| 468 |
+
# Find what topics depend on this one
|
| 469 |
+
dependents = []
|
| 470 |
+
for other_topic, other_data in self.topics_data.items():
|
| 471 |
+
if topic_name in other_data['prerequisites']:
|
| 472 |
+
dependents.append(other_topic)
|
| 473 |
+
|
| 474 |
+
if dependents:
|
| 475 |
+
result += f"\n**π― Topics that require {topic_name}:**\n"
|
| 476 |
+
for dependent in dependents:
|
| 477 |
+
result += f"β’ {dependent}\n"
|
| 478 |
+
|
| 479 |
+
return result
|
| 480 |
+
|
| 481 |
+
def get_difficulty_based_roadmap(self, difficulty: str) -> str:
|
| 482 |
+
"""Get all topics for a specific difficulty level"""
|
| 483 |
+
topics_by_difficulty = {
|
| 484 |
+
'Beginner': [],
|
| 485 |
+
'Intermediate': [],
|
| 486 |
+
'Advanced': []
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
for topic_name, topic_data in self.topics_data.items():
|
| 490 |
+
topics_by_difficulty[topic_data['difficulty']].append(topic_name)
|
| 491 |
+
|
| 492 |
+
if difficulty not in topics_by_difficulty:
|
| 493 |
+
return "β Invalid difficulty level!"
|
| 494 |
+
|
| 495 |
+
result = f"π **{difficulty} Level DSA Topics**\n\n"
|
| 496 |
+
|
| 497 |
+
topics = topics_by_difficulty[difficulty]
|
| 498 |
+
if not topics:
|
| 499 |
+
result += "No topics found for this difficulty level."
|
| 500 |
+
return result
|
| 501 |
+
|
| 502 |
+
for i, topic in enumerate(topics, 1):
|
| 503 |
+
topic_data = self.topics_data[topic]
|
| 504 |
+
result += f"**{i}. {topic}**\n"
|
| 505 |
+
result += f" *Time: {topic_data['time_estimate']}*\n"
|
| 506 |
+
result += f" *{topic_data['description']}*\n\n"
|
| 507 |
+
|
| 508 |
+
return result
|
| 509 |
+
|
| 510 |
+
def get_all_topics_overview(self) -> str:
|
| 511 |
+
"""Get overview of all topics with their relationships"""
|
| 512 |
+
result = "πΊοΈ **Complete DSA Topics Overview**\n\n"
|
| 513 |
+
|
| 514 |
+
# Group by difficulty
|
| 515 |
+
by_difficulty = {'Beginner': [], 'Intermediate': [], 'Advanced': []}
|
| 516 |
+
for topic, data in self.topics_data.items():
|
| 517 |
+
by_difficulty[data['difficulty']].append(topic)
|
| 518 |
+
|
| 519 |
+
for difficulty in ['Beginner', 'Intermediate', 'Advanced']:
|
| 520 |
+
result += f"## {difficulty} Topics\n"
|
| 521 |
+
for topic in by_difficulty[difficulty]:
|
| 522 |
+
result += f"β’ **{topic}** ({self.topics_data[topic]['time_estimate']})\n"
|
| 523 |
+
result += "\n"
|
| 524 |
+
|
| 525 |
+
result += "**π‘ Tips:**\n"
|
| 526 |
+
result += "β’ Start with Beginner topics if you're new to DSA\n"
|
| 527 |
+
result += "β’ Each topic builds upon previous knowledge\n"
|
| 528 |
+
result += "β’ Practice problems regularly to reinforce concepts\n"
|
| 529 |
+
result += "β’ Focus on understanding connections between topics\n"
|
| 530 |
+
|
| 531 |
+
return result
|
| 532 |
+
|
| 533 |
+
# Initialize the DSA roadmap system
|
| 534 |
+
dsa_system = DSALearningRoadmap()
|
| 535 |
+
|
| 536 |
+
# Get list of all topics for dropdown
|
| 537 |
+
all_topics = list(dsa_system.topics_data.keys())
|
| 538 |
+
difficulty_levels = ['All', 'Beginner', 'Intermediate', 'Advanced']
|
| 539 |
+
|
| 540 |
+
def generate_roadmap(topic_name):
|
| 541 |
+
"""Generate roadmap for selected topic"""
|
| 542 |
+
return dsa_system.get_topic_roadmap(topic_name)
|
| 543 |
+
|
| 544 |
+
def show_prerequisites_chain(topic_name):
|
| 545 |
+
"""Show complete prerequisite chain"""
|
| 546 |
+
return dsa_system.get_prerequisites_chain(topic_name)
|
| 547 |
+
|
| 548 |
+
def show_topic_connections(topic_name):
|
| 549 |
+
"""Show topic interconnections"""
|
| 550 |
+
return dsa_system.get_topic_connections(topic_name)
|
| 551 |
+
|
| 552 |
+
def show_difficulty_roadmap(difficulty):
|
| 553 |
+
"""Show topics by difficulty"""
|
| 554 |
+
if difficulty == 'All':
|
| 555 |
+
return dsa_system.get_all_topics_overview()
|
| 556 |
+
return dsa_system.get_difficulty_based_roadmap(difficulty)
|
| 557 |
+
|
| 558 |
+
# Create the Gradio interface
|
| 559 |
+
with gr.Blocks(title="π― DSA Learning Roadmap", theme=gr.themes.Soft()) as app:
|
| 560 |
+
gr.Markdown("""
|
| 561 |
+
# π― DSA Learning Roadmap Generator
|
| 562 |
+
|
| 563 |
+
**Solve the problem of not knowing DSA prerequisites!**
|
| 564 |
+
|
| 565 |
+
This tool helps you understand:
|
| 566 |
+
- π What to learn before tackling any DSA topic
|
| 567 |
+
- πΊοΈ Step-by-step learning paths
|
| 568 |
+
- π How topics interconnect with each other
|
| 569 |
+
- β±οΈ Time estimates for mastering each topic
|
| 570 |
+
|
| 571 |
+
Select any topic below to get your personalized roadmap!
|
| 572 |
+
""")
|
| 573 |
+
|
| 574 |
+
with gr.Tabs():
|
| 575 |
+
# Tab 1: Individual Topic Roadmap
|
| 576 |
+
with gr.TabItem("π Topic Roadmap"):
|
| 577 |
+
gr.Markdown("### Get detailed roadmap for any DSA topic")
|
| 578 |
+
|
| 579 |
+
topic_dropdown = gr.Dropdown(
|
| 580 |
+
choices=all_topics,
|
| 581 |
+
label="π― Select a DSA Topic",
|
| 582 |
+
value="Arrays",
|
| 583 |
+
info="Choose any topic to get a complete learning roadmap"
|
| 584 |
+
)
|
| 585 |
+
|
| 586 |
+
generate_btn = gr.Button("π Generate Roadmap", variant="primary")
|
| 587 |
+
roadmap_output = gr.Markdown(label="π Your Learning Roadmap")
|
| 588 |
+
|
| 589 |
+
generate_btn.click(
|
| 590 |
+
fn=generate_roadmap,
|
| 591 |
+
inputs=topic_dropdown,
|
| 592 |
+
outputs=roadmap_output
|
| 593 |
+
)
|
| 594 |
+
|
| 595 |
+
# Auto-generate on selection change
|
| 596 |
+
topic_dropdown.change(
|
| 597 |
+
fn=generate_roadmap,
|
| 598 |
+
inputs=topic_dropdown,
|
| 599 |
+
outputs=roadmap_output
|
| 600 |
+
)
|
| 601 |
+
|
| 602 |
+
# Tab 2: Prerequisites Chain
|
| 603 |
+
with gr.TabItem("π Prerequisites Chain"):
|
| 604 |
+
gr.Markdown("### See the complete learning path to master any topic")
|
| 605 |
+
|
| 606 |
+
prereq_dropdown = gr.Dropdown(
|
| 607 |
+
choices=all_topics,
|
| 608 |
+
label="π― Select Target Topic",
|
| 609 |
+
value="Dynamic Programming",
|
| 610 |
+
info="See everything you need to learn before mastering this topic"
|
| 611 |
+
)
|
| 612 |
+
|
| 613 |
+
prereq_btn = gr.Button("π Show Learning Path", variant="primary")
|
| 614 |
+
prereq_output = gr.Markdown(label="π Complete Learning Path")
|
| 615 |
+
|
| 616 |
+
prereq_btn.click(
|
| 617 |
+
fn=show_prerequisites_chain,
|
| 618 |
+
inputs=prereq_dropdown,
|
| 619 |
+
outputs=prereq_output
|
| 620 |
+
)
|
| 621 |
+
|
| 622 |
+
prereq_dropdown.change(
|
| 623 |
+
fn=show_prerequisites_chain,
|
| 624 |
+
inputs=prereq_dropdown,
|
| 625 |
+
outputs=prereq_output
|
| 626 |
+
)
|
| 627 |
+
|
| 628 |
+
# Tab 3: Topic Connections
|
| 629 |
+
with gr.TabItem("π Topic Connections"):
|
| 630 |
+
gr.Markdown("### Understand how topics connect to each other")
|
| 631 |
+
|
| 632 |
+
connection_dropdown = gr.Dropdown(
|
| 633 |
+
choices=all_topics,
|
| 634 |
+
label="π― Select Topic",
|
| 635 |
+
value="Trees",
|
| 636 |
+
info="See how this topic connects to other DSA concepts"
|
| 637 |
+
)
|
| 638 |
+
|
| 639 |
+
connection_btn = gr.Button("π Show Connections", variant="primary")
|
| 640 |
+
connection_output = gr.Markdown(label="π Topic Interconnections")
|
| 641 |
+
|
| 642 |
+
connection_btn.click(
|
| 643 |
+
fn=show_topic_connections,
|
| 644 |
+
inputs=connection_dropdown,
|
| 645 |
+
outputs=connection_output
|
| 646 |
+
)
|
| 647 |
+
|
| 648 |
+
connection_dropdown.change(
|
| 649 |
+
fn=show_topic_connections,
|
| 650 |
+
inputs=connection_dropdown,
|
| 651 |
+
outputs=connection_output
|
| 652 |
+
)
|
| 653 |
+
|
| 654 |
+
# Tab 4: Difficulty-based Overview
|
| 655 |
+
with gr.TabItem("π By Difficulty"):
|
| 656 |
+
gr.Markdown("### Browse topics by difficulty level")
|
| 657 |
+
|
| 658 |
+
difficulty_dropdown = gr.Dropdown(
|
| 659 |
+
choices=difficulty_levels,
|
| 660 |
+
label="π Select Difficulty Level",
|
| 661 |
+
value="All",
|
| 662 |
+
info="View topics grouped by difficulty"
|
| 663 |
+
)
|
| 664 |
+
|
| 665 |
+
difficulty_btn = gr.Button("π Show Topics", variant="primary")
|
| 666 |
+
difficulty_output = gr.Markdown(label="π Topics by Difficulty")
|
| 667 |
+
|
| 668 |
+
difficulty_btn.click(
|
| 669 |
+
fn=show_difficulty_roadmap,
|
| 670 |
+
inputs=difficulty_dropdown,
|
| 671 |
+
outputs=difficulty_output
|
| 672 |
+
)
|
| 673 |
+
|
| 674 |
+
difficulty_dropdown.change(
|
| 675 |
+
fn=show_difficulty_roadmap,
|
| 676 |
+
inputs=difficulty_dropdown,
|
| 677 |
+
outputs=difficulty_output
|
| 678 |
+
)
|
| 679 |
+
|
| 680 |
+
# Footer
|
| 681 |
+
gr.Markdown("""
|
| 682 |
+
---
|
| 683 |
+
### π‘ How to Use This Tool:
|
| 684 |
+
1. **Topic Roadmap**: Get detailed learning plan for any specific topic
|
| 685 |
+
2. **Prerequisites Chain**: See exactly what to learn before your target topic
|
| 686 |
+
3. **Topic Connections**: Understand how topics relate to each other
|
| 687 |
+
4. **By Difficulty**: Browse topics based on your current skill level
|
| 688 |
+
|
| 689 |
+
### π― Pro Tips:
|
| 690 |
+
- Start with **Beginner** topics if you're new to DSA
|
| 691 |
+
- Follow the **Prerequisites Chain** for optimal learning order
|
| 692 |
+
- Practice the **Important Problems** listed in each roadmap
|
| 693 |
+
- Use **Topic Connections** to plan your learning journey
|
| 694 |
+
|
| 695 |
+
**Happy Learning! π**
|
| 696 |
+
""")
|
| 697 |
+
|
| 698 |
+
# Launch the app
|
| 699 |
+
if __name__ == "__main__":
|
| 700 |
+
app.launch(share=True)
|