12 Min Read

How to Master Data Structures & Algorithms in Semester 3: A Complete Roadmap

Published: October 2026 • Author: Sarthak Pawar

Data Structures and Algorithms (DSA) is the subject that separates engineers who get placed at top companies from those who don't. It is not an exaggeration to say that if you master DSA in Semester 3, you have built the single most important skill for your entire career in technology. Google, Microsoft, Amazon, Flipkart, and virtually every product company worth working at will test you on DSA in their technical interviews. More immediately, DSA is worth significant marks in your SY autonomous ETE, and it is the subject where conceptual understanding pays off far more than rote memorization.

Why DSA Is Harder Than You Expect

Most students approach DSA the wrong way. They read the theory, understand it conceptually, and think they are ready. Then they open a practice problem and stare at a blank screen. This happens because DSA is a skill, not knowledge—it requires deliberate practice with active problem solving, not passive reading. The good news is that once you break through the initial barrier, problems start clicking together rapidly because DSA has patterns. Once you recognize that a problem requires a sliding window, or a BFS traversal, or a dynamic programming table, the solution follows naturally.

📐 The Core DSA Learning Progression

  • Week 1-2: Arrays, strings, and basic searching. Master linear search, binary search, and two-pointer technique. These appear in 40% of interview problems in disguised form.
  • Week 3-4: Linked lists, stacks, and queues. Implement each from scratch in C. Understand pointer manipulation deeply—it teaches memory management that transfers to all languages.
  • Week 5-6: Recursion and trees. Practice writing recursive solutions for every tree traversal. Understand the call stack. Master BST insertion, deletion, and search.
  • Week 7-8: AVL trees and B-trees (exam-critical). Understand rotations conceptually—draw them, not just memorize the code. Heaps and heap sort.
  • Week 9-10: Graphs (BFS, DFS, Dijkstra, Prim, Kruskal). This is the hardest and most rewarding section. Graph problems appear constantly in interviews.
  • Week 11-12: Sorting algorithms with full complexity analysis. Hash tables and collision resolution. Review and mock exam practice.

Understanding Time & Space Complexity — The Non-Negotiable Foundation

Before writing a single line of DSA code, you must be completely comfortable with Big-O notation. It is the language with which you evaluate and compare algorithms. Big-O describes the worst-case growth rate of an algorithm's runtime or memory usage as the input size n approaches infinity. Here is how to think about the common complexities from best to worst:

O(1) — Constant Time: The operation takes the same amount of time regardless of input size. Examples: array element access by index, hash table lookup (average case), stack push/pop.

O(log n) — Logarithmic Time: The problem is halved with each step. Examples: binary search in a sorted array, BST search (average case), finding an element in an AVL tree. If you have 1 million elements and your algorithm is O(log n), it takes only about 20 steps to find your target.

O(n) — Linear Time: You must visit every element once. Examples: linear search, traversing a linked list, finding the maximum element in an unsorted array. This is often the best you can achieve for problems where you must examine all input.

O(n log n) — Linearithmic Time: This is the efficiency of the best general-purpose sorting algorithms: merge sort, heap sort, and quicksort (average case). It is the theoretical lower bound for comparison-based sorting algorithms.

O(n²) — Quadratic Time: Usually involves nested loops over the same data. Examples: bubble sort, selection sort, insertion sort, and brute-force 2-sum problems. Acceptable for small inputs (n < 1000) but unusable at scale.

The AVL Tree Rotation System — Exam Deep Dive

AVL trees are self-balancing Binary Search Trees invented by Adelson-Velsky and Landis in 1962. The key insight is simple: in a regular BST, repeated insertions in sorted order degenerate the tree into a linked list (O(n) search), defeating the entire purpose. AVL trees maintain a balance condition: for every node, the height difference between its left and right subtrees (called the Balance Factor, or BF) must be -1, 0, or +1. When an insertion violates this condition, a rotation corrects it.

There are four rotation cases you must know cold for your ETE paper:

  • LL Rotation (Single Right Rotation): Occurs when a node is inserted in the Left subtree of the Left child of the unbalanced node. Solution: rotate the unbalanced node to the right. The left child becomes the new root of the subtree.
  • RR Rotation (Single Left Rotation): Mirror of LL. Inserted in the Right subtree of the Right child. Solution: rotate left. The right child becomes the new root.
  • LR Rotation (Double Rotation — Left then Right): Inserted in the Right subtree of the Left child. Two-step process: first rotate the left child left (making it an LL case), then rotate the unbalanced node right.
  • RL Rotation (Double Rotation — Right then Left): Inserted in the Left subtree of the Right child. First rotate the right child right (making it an RR case), then rotate the unbalanced node left.

In your exam answer, always: (1) Draw the tree before insertion, (2) Show the inserted node, (3) Calculate the Balance Factor of each ancestor node bottom-up, (4) Identify the unbalanced node and the rotation type, (5) Draw the tree after rotation with updated Balance Factors.

Graph Algorithms — BFS vs DFS Decision Framework

Graphs are the most powerful and versatile data structure in computer science. Social networks, road maps, the internet itself, recommendation systems, and dependency graphs are all modeled as graphs. Understanding when to use BFS versus DFS is a critical judgment call.

Use BFS (Breadth-First Search) when: you need the shortest path in an unweighted graph, you want to find all nodes at a given distance from a source, or you are solving problems where the solution is likely close to the source. BFS uses a Queue and visits nodes level by level. Time complexity: O(V + E) where V is vertices and E is edges.

Use DFS (Depth-First Search) when: you want to detect cycles, perform topological sorting (for scheduling problems), find connected components, or solve maze-like problems where you need to explore a path fully before backtracking. DFS uses a Stack (explicitly or via recursion) and dives deep before backtracking. Time complexity: O(V + E).

Use Dijkstra's Algorithm when: you need the shortest path in a weighted graph with non-negative edge weights. Dijkstra uses a min-priority queue (min-heap) to always expand the node with the smallest tentative distance. It is a greedy algorithm. Time complexity: O((V + E) log V) with a binary heap.

🔗 Related Study Resources