Data Structures & Algorithms with Python
Duration: 8 Weeks (Weekdays)
Language: Python 3.x
Pre-Requisites (Mandatory Before Week 1)
Python Fundamentals
Participants must be comfortable with:
• Python syntax & indentation
• Variables & data types (int, float, str, bool)
• Conditional statements (if, elif, else)
• Loops (for, while)
• Functions & parameters
• return vs print
• Basic recursion understanding
Python Built-in Data Types
• list (append, pop, slicing)
• tuple (immutability concept)
• set (unique elements, membership)
• dict (key-value pairs, hashing concept)
Required Python Concepts
• List comprehension
• String slicing & methods
• Basic input() handling
• Reading Python error messages
Module 1: DSA Foundations & Complexity Analysis (Week 1)
Python-Centric Concepts
• What is DSA and why Python is suitable
• Interpreted vs compiled language impact on performance
• Why complexity matters more than syntax
Time Complexity
• Big-O, Big-Ω, Big-Θ
• Best / Worst / Average case
• Python loop analysis
• Nested loops & logarithmic behavior
Space Complexity
• Variables vs auxiliary space
• Recursion stack space
• Python list growth behavior
Recursion in Python
• Call stack behavior
• Base condition importance
• Recursive vs iterative trade-offs
Hands-on (Python)
• Complexity of for, while, nested loops
• Recursive Fibonacci (with stack trace)
• Identify complexity from Python code
Assignment
• Complexity analysis worksheet (10 Python snippets)
Module 2: Arrays & Strings (Week 2)
Arrays in Python
• Python list as dynamic array
• Indexing, traversal, slicing
• Insert & delete cost analysis
• list vs array module (conceptual)
Array Problem Patterns
• Two pointers
• Prefix sum
• Sliding window
Strings in Python
• Strings as immutable arrays
• Character iteration
• ASCII & ord() / chr()
• Common string methods
String Problem Patterns
• Palindrome check
• Anagram detection
• Frequency counting using dict
Hands-on
• Reverse array (3 approaches)
• Max / Min element
• Subarray sum
• Palindrome & anagram validation
Assignment
• 15 Python array & string problems (Easy → Medium)
Module 3: Linked Lists (Week 3)
Python Implementation
• Why linked lists when lists exist?
• Node class design in Python
• Memory references in Python
Singly Linked List
• Insert (beginning, end, position)
• Delete (by value, position)
• Search & traversal
Reversal Techniques
• Iterative reversal
• Recursive reversal
Cycle Detection
• Floyd’s Cycle Detection (Tortoise & Hare)
Doubly Linked List
• Bidirectional traversal
• Use-cases
LRU Cache (Conceptual)
• DLL + Dictionary (OrderedDict intro)
Hands-on
• Reverse linked list
• Detect & remove loop
• Merge two sorted linked lists
Assignment
• Implement complete Linked List in Python
Module 4: Stack & Queue (Week 4)
Stack in Python
• Stack using list
• Stack using [Link]
Stack Applications
• Expression validation
• Infix → Postfix
• Undo / Redo
• Function calls
Advanced Stack Concepts
• Min Stack
• Monotonic Stack
Queue in Python
• Queue using deque
• Circular Queue
• Deque operations
Inter-conversion
• Queue using Stack
• Stack using Queue
Hands-on
• Balanced parentheses
• Min Stack implementation
Assignment
• Mini project: Undo / Redo system (Python Stack)
Module 5: Trees & Binary Search Trees (Week 5)
Tree Fundamentals
• Node-based tree representation
• Binary Tree vs BST
Tree Traversals (Recursive & Iterative)
• In-order
• Pre-order
• Post-order
• Level-order (Queue based)
Binary Search Tree
• Insert
• Search
• Delete
Tree Problems
• Height
• Diameter
• Lowest Common Ancestor (LCA)
Hands-on
• Build tree from scratch
• All traversals in Python
• BST operations
Assignment
• Tree traversal worksheet / visualizer logic
Module 6: Heap, Trie & Graphs (Week 6)
Heap in Python
• Min Heap & Max Heap
• heapq module internals
• Priority Queue
Trie
• Prefix tree implementation
• Word search & auto-complete
Hashing Internals
• Python dictionary internals
• Collision handling (conceptual)
Graphs
• Adjacency List (dict)
• Adjacency Matrix (list of lists)
Graph Traversals
• DFS (Recursive & Stack)
• BFS (Queue)
Cycle Detection
• Directed & Undirected graphs
Hands-on
• DFS & BFS in Python
• Cycle detection problems
Assignment
• Graph traversal problem set
Module 7: Advanced Graph Algorithms & Sorting (Week 7)
Shortest Path Algorithms
• Dijkstra (Heap based)
• Bellman-Ford
Minimum Spanning Tree
• Kruskal (Union-Find)
• Prim (Heap based)
Topological Sort
• DFS based
• Kahn’s Algorithm
Sorting Algorithms (Python Focus)
• Bubble
• Selection
• Insertion
• Merge
• Quick
• Heap
• Python sorted() vs manual sorting
Hands-on
• Sorting comparisons
• Graph shortest path problems
Assignment
• Sorting & graph algorithm comparison worksheet
Module 8: Dynamic Programming & Course Wrap-up (Week 8)
DP Fundamentals
• Recursion → DP
• Overlapping subproblems
• Optimal substructure
Memoization vs Tabulation
• Python dictionaries
• List-based DP
1D DP
• Fibonacci
• Climbing stairs
2D DP
• Longest Common Subsequence
• Longest Increasing Subsequence
Knapsack
• 0/1 Knapsack
Hands-on
• Solve classic DP problems
Assignment
• 8 standard DP problems (Python)
Final Assessment
• Mixed DSA coding test (Python)
• Mock technical interview
• Problem-solving discussion
• Time & space trade-off analysis