← Back to Tutorials Chapter 14

Practice & Certification

This chapter brings everything together. You will find example problems with solutions, exercises organized by difficulty, quiz questions, a syllabus outline, an 8-week study plan, interview preparation tips, and DSA certification paths.

The best way to learn DSA is to write code every day. Aim to solve at least one problem daily. Start with easy problems, then move to medium, then hard.
DSA learning path

Example Problems with Solutions

Problem 1: Two Sum (Easy)

Given an array of integers and a target, return indices of two numbers that add up to the target.

def two_sum(nums, target):
    seen = {}
    for i, num in enumerate(nums):
        complement = target - num
        if complement in seen:
            return [seen[complement], i]
        seen[num] = i
    return []

Time: O(n), Space: O(n).

Problem 2: Maximum Subarray (Medium)

Find the contiguous subarray with the largest sum (Kadane's Algorithm).

def max_subarray(nums):
    max_ending = max_sofar = nums[0]
    for x in nums[1:]:
        max_ending = max(x, max_ending + x)
        max_sofar = max(max_sofar, max_ending)
    return max_sofar

Time: O(n), Space: O(1).

Problem 3: Merge K Sorted Lists (Hard)

Merge k sorted linked lists into one sorted list. Use a min-heap.

import heapq

def merge_k_lists(lists):
    heap = []
    for i, lst in enumerate(lists):
        if lst:
            heapq.heappush(heap, (lst[0], i, 0))

    result = []
    while heap:
        val, list_idx, elem_idx = heapq.heappop(heap)
        result.append(val)
        if elem_idx + 1 < len(lists[list_idx]):
            next_val = lists[list_idx][elem_idx + 1]
            heapq.heappush(heap, (next_val, list_idx, elem_idx + 1))
    return result

Time: O(N log k), where N is total elements and k is number of lists.

Exercises by Difficulty

Easy

Medium

Hard

Quiz Questions

  1. What is the time complexity of binary search? Answer: O(log n)
  2. Which sorting algorithm has the best worst-case time complexity? Answer: Merge Sort / Heap Sort (O(n log n))
  3. What data structure is used for DFS? Answer: Stack (recursive call stack)
  4. What is the space complexity of Merge Sort? Answer: O(n)
  5. When does a greedy algorithm fail? Answer: When the greedy choice property does not hold — local optima do not lead to global optimum.
  6. What is the key difference between Prim's and Kruskal's algorithms? Answer: Prim grows vertex-by-vertex; Kruskal grows edge-by-edge using Union-Find.
  7. State the Max-Flow Min-Cut theorem. Answer: The maximum flow value equals the minimum cut capacity.
  8. Explain the difference between memoization and tabulation in DP. Answer: Memoization is top-down (recursion + cache); tabulation is bottom-up (iterative table filling).

Syllabus Outline

ModuleTopics
1. FoundationsComplexity analysis, recursion, problem-solving patterns
2. Arrays & SortingArray manipulations, sorting algorithms, searching
3. Linked ListsSingly, doubly, circular, fast & slow pointer
4. Stacks & QueuesStack, queue, deque, priority queue, monotonic stack
5. Hash TablesHashing, collision resolution, hash map patterns
6. TreesBinary trees, BST, traversals, AVL, heaps, tries
7. GraphsRepresentation, BFS, DFS, cycle detection, topological sort
8. Advanced GraphsShortest paths, MST, maximum flow
9. DP & GreedyDynamic programming, greedy algorithms
10. Advanced TopicsBacktracking, bit manipulation, string algorithms, segment trees

8-Week Study Plan

WeekFocusProblems per Day
1Complexity, Arrays, Sorting, Searching2
2Linked Lists, Stacks, Queues2
3Hash Tables, Recursion2
4Trees, BST, Heaps2
5Graphs: BFS, DFS, Topological Sort2
6Shortest Paths, MST, Maximum Flow1-2
7Dynamic Programming2
8Greedy, Backtracking, Review & Mock Interviews3

Interview Preparation Tips

Certification Paths

Certifications are helpful for building confidence and structuring your learning, but portfolio projects and mock interviews are just as important for landing a job.

Practice Task

Pick one easy, one medium, and one hard problem from the lists above. Solve all three without looking at any reference. Time yourself. If you complete the easy in under 10 minutes, the medium in under 25, and the hard in under 45, you are ready for most technical interviews.