IITP · Semester ISummaries · Quizzes · Assignments

Lecture summary

DAA 01 Nov Lab

01 Nov 202651m 04s1 parts

Source: IITP-big-files\Sem-1\ECS5101-DAA\Lectures\2026-11-01 0000 DAA 01 Nov Lab\summary\notes.md

Overview

This class focused on the format and content of the upcoming exam for the Design & Analysis of Algorithms course. It detailed the types of questions to expect, including programming, fill-in-the-blanks, matching, and objective questions. The session reviewed key algorithms and data structures that will be tested, such as sorting algorithms, AVL trees, graph algorithms, and dynamic programming. It also covered important administrative logistics regarding the proctored exam schedule and submission requirements.

Learning outcomes

  • Identify and match algorithms with their correct time and space complexities.
  • Understand the structure and expectations for the proctored mid-term exam.
  • Recognize the specific algorithms and data structures that are in scope for the exam.

Core concepts

Exam Question Types

The exam will feature various question formats including programming questions (~30), fill-in-the-blanks, match-the-following, and objective questions. This matters because it defines how knowledge will be assessed and requires different test-taking strategies.

Time/Space Complexity Matching

A core exam task involves pairing given algorithms with their correct worst-case or average-case time and space complexities. This is fundamental to algorithm analysis and connects to evaluating algorithm efficiency for different inputs.

Sorting Algorithm Review

Specific sorting algorithms and their properties were highlighted as key exam topics. This connects to broader themes of algorithm design and analysis, as sorting is a foundational problem used to illustrate complexity concepts.

Graph and Tree Algorithms

Algorithms like DFS, BFS, Hamiltonian cycle, and AVL tree rotations were mentioned as being on the exam. These are central data structure operations, connecting traversal, search, and balancing concepts.

Dynamic Programming Application

Dynamic programming, specifically for DNA sequence matching, was noted. This connects the concept of optimal substructure and overlapping subproblems to a practical bioinformatics application.

Heap Sort Mechanics

Heap Sort builds a max heap, then repeatedly swaps the root with the last element of the active heap and heapifies the reduced heap. Its major advantage over Quick Sort is that it guarantees O(n log n) worst-case time. Heap Sort is not stable. In a Min Heap, the minimum element is always at the root.

Formulas and maths

  • Quicksort time complexity: O(n^2)
    • Symbols: n is the number of elements to sort.
    • Use: Represents the worst-case time complexity of quicksort.
  • Quicksort average-case time complexity: O(n log n)
    • Symbols: n is the number of elements to sort.
    • Use: Represents the average-case time complexity, arising from balanced partitions on average.
  • Binary search time complexity: O(log n)
    • Symbols: n is the number of elements in the sorted array.
    • Use: Represents the time complexity for searching in a sorted array.
  • Heap sort space complexity: O(1)
    • Symbols: No variable; constant space.
    • Use: Indicates heap sort is an in-place sorting algorithm.
  • Counting sort time complexity: O(n + k)
    • Symbols: n is the number of elements, k is the range of the input.
    • Use: Represents the time complexity for sorting when the range of input is limited.
  • Quicksort average recursive stack space: O(log n)
    • Symbols: n is the number of elements.
    • Use: Represents the average-case space complexity due to recursion depth.

Worked examples

  • Bottom-up max heap construction on [4, 10, 3, 5, 1]: heapifying from the last internal node upward gives the max heap [10, 5, 3, 4, 1].

Questions asked in class

  • Q: Will the exam be similar to the quiz format?
    • A: No, it will be different. It will be proctored with camera on, screen recording, and detection of tab changes/head movement.
  • Q: Will the exam be open for all subjects on a given date or one subject per day?
    • A: It will be open for all subjects on the given dates. A student can take all exams in one day or schedule them as desired within the open window.
  • Q: Is there a fixed time slot (e.g., 2-3 hours) or can we choose any time within a 24-hour window?
    • A: The exam link will be open for a duration (e.g., 12 PM to 5 PM). You can pick any time within that window to start your exam, which will then run for its fixed duration.
  • Q: Are there operating system dependencies? Can I use Mac, Windows, or Linux?
    • A: The exam website can open everywhere; the operating system does not matter. No specific app needs to be installed.

Key takeaways

  • The exam is proctored, requiring camera, screen recording, and monitoring for tab changes.
  • The exam window is open for a period (e.g., 12 PM to 5 PM), within which you choose your start time.
  • Question types include programming, fill-in-the-blanks, match-the-following, and objective questions.
  • Key algorithms to know: Quicksort, Binary Search, Heap Sort, Counting Sort.
  • Know the worst-case time complexity of Quicksort is O(n²).
  • Know the average-case time complexity of Quicksort is O(n log n), from balanced partitions on average.
  • Know that Binary Search has O(log n) time complexity.
  • Heap sort is in-place, with O(1) space complexity.
  • Heap sort guarantees O(n log n) worst-case time, its major advantage over Quick Sort.
  • Heap sort is not stable.
  • In a Min Heap, the minimum element is always at the root.
  • Counting sort has O(n + k) time complexity.
  • AVL tree rotations and graph algorithms (DFS, BFS, Hamiltonian cycle) are on the exam.
  • Dynamic programming for DNA sequence matching will be tested.
  • The operating system (Mac, Windows, Linux) does not matter for taking the exam.

Exam-style questions

  1. Match the following algorithms with their worst-case time complexities: Algorithms: Quicksort, Binary Search, Heap Sort, Counting Sort. Complexities: O(n²), O(log n), O(n log n), O(n + k). Answer Outline: Quicksort - O(n²); Binary Search - O(log n); Heap Sort - O(n log n); Counting Sort - O(n + k).

  2. Describe the proctoring setup for the DAA exam. Answer Outline: The exam is proctored using a camera, screen recording software, and software that detects tab changes or significant head movement during the test.

  3. A sorting algorithm operates in O(1) auxiliary space. Which algorithm is this, and what is its average-case time complexity? Answer Outline: This describes Heap Sort. Its average-case time complexity is O(n log n).

  4. During Heap Sort on a max heap, what happens after the root is swapped with the last element of the active heap? Answer Outline: The reduced heap is heapified.

  5. Is Heap Sort a stable sorting algorithm? Answer Outline: No, generally not.

Glossary

  • Proctored Exam - An exam monitored via camera and software to ensure academic integrity.
  • Time Complexity - A measure of the amount of time an algorithm takes relative to its input size.
  • Space Complexity - A measure of the amount of memory an algorithm uses relative to its input size.
  • In-place Algorithm - An algorithm that uses only a constant amount of extra memory space (O(1)).
  • AVL Tree - A self-balancing binary search tree where the heights of the two child subtrees of any node differ by at most one.
  • Min Heap - A heap in which the minimum element is always at the root.
  • Stable Sort - A sort that preserves the relative order of equal elements; Heap Sort is generally not stable.

Follow-ups

  • B-trees and B+ trees will be covered in the next class.
  • A revision class is planned for the mid-term exam.
  • Lab 9 exists but is not due yet; it will be included by the end of November or in December.
  • The instructor noted that some topics (heapsort, quicksort, binary search) were not removed from the material as intended.