classnotes RTX 4070 Ti SUPER · faster-whisper · DeepSeek

5101 - Design & Analysis of Algo

← 5101 - Design & Analysis of Algo

DAA_23 Aug

Date 2026-08-23 Length 1h 33m Words 10,966 Segments 654
⤓ Download transcript (.txt with timestamps) ⤓ Plain transcript (.txt) ⤓ Transcript (.md)

Summary


session: "5101-design-analysis-of-algo/2026-08-23 0000 DAA 23 Aug"

title: "DAA 23 Aug"

date: "2026-08-23 00:00"

duration: "1h 33m"

language: "en"

model: "deepseek-ai/DeepSeek-V4.1-Flash-1017"

parts: 2

transcript_chars: 54611

generated: "2026-11-23T23:26:10+05:30"


DAA 23 Aug

Overview

This class completes the mathematical foundations needed for algorithm analysis and then introduces algorithms and algorithmic analysis proper. It recaps monotonicity, then covers floor/ceiling, modular arithmetic (including negative numbers), the integer and absolute value functions, exponentials, factorials, Fibonacci, polynomial representation via summation, and logarithms, before giving a simplified definition of an algorithm. The second half covers modular programming, a first algorithm (finding the largest element in an array), the components of an algorithm (step, control, exit, variable, comment, input/output, assignment), the three flow types (sequential, selection, iterative), and a quadratic-root procedure. It closes with the motivation for algorithmic analysis: efficiency and scalability, running time as a function of input size, and the two critical factors — input size and the dominating operation. Asymptotic analysis (big O, little O, big omega, big theta, little omega) is announced for the next class.

Learning outcomes

Core concepts

Monotonicity and strict monotonicity

A monotonic function behaves similarly throughout — if increasing, it keeps increasing; if decreasing, it keeps decreasing. Strict monotonicity removes the equality sign: at no point are the two values (e.g., m and n) equal. Monotonically increasing functions are popular in algorithmic complexity because as input size increases, the number of computational steps increases side by side, so complexity can be easily determined.

Floor and ceiling

Floor is the greatest integer less than or equal to x; ceiling is the least integer greater than or equal to x, where x is a real number. For positive numbers, floor is the integer part and ceiling is the next integer; for negative numbers, ceiling is the integer part and floor is the next lowest number on the number line. These underpin the int function and later asymptotic bounds.

Modular function and congruence

a mod n identifies the remainder when a is divided by n; in general form k = mq + r, where r is the remainder. Congruence: if a mod n = b mod n, we write a ≡ b mod n, which holds if and only if n divides b − a (the remainder of (b − a) divided by n is 0), with a, b, n integers; you may take a larger a and smaller b or vice versa. This is not the triangle congruence of 9th/10th; it appears indirectly in algorithm analysis.

Integer and absolute value functions

The int function fetches just the integer component: int x = floor of x when x is positive, int x = ceiling of x when x is negative. There is no rounding — only the integer component is identified. The absolute value function gives a positive integer as output whatever the input.

Exponential properties

a⁰ = 1; a¹ = a; reverse power a^(−1) = 1/a; (a^m)^n = a^(m·n); same denominator with different powers: multiply/add powers as m + n (as stated in class). These facts "will definitely appear multiple times while estimating the computational complexity via asymptotic analysis."

Factorial and Fibonacci

Factorial is defined recursively: n! = n × (n−1)!, with base case 0! = 1; the process recursively calls the step until n = 0. Fibonacci starts with f(0) = 0 and f(1) = 1; each subsequent term is the sum of the two preceding terms. Fibonacci-type series occasionally appear as special series in asymptotic analysis.

Polynomial representation via summation

A polynomial is not stored exactly as written; instead its coefficients are stored along with the highest degree, and the expression is recreated using a summation (essentially a for loop). This connects to how algorithms' running-time functions are represented.

Logarithm

By default, log is treated as base 2 (because systems use 0 and 1, i.e., binary); ln is base e; if a different base applies it will be stated explicitly. Log properties were mentioned but flagged for full explanation during asymptotic analysis.

Definition of an algorithm

Naïve/simplified definition: a finite step-by-step list of well-defined instructions for solving a particular problem — a sequence of instructions for solving a problem. Issue with this definition: algorithms should be applicable to a subset of input (already known).

Modular programming

The main module is divided into different sub-modules, which may or may not be interdependent — e.g., a calculator program whose main function calls separate functions for addition, subtraction, multiplication and division. Benefit: if there is a bug in a function, the main program execution is not hampered, and fixing/removing errors is easy. It is presented as the best mechanism for writing algorithms.

Largest element in an array (first algorithm)

Declare the first element as max (and its location as loc), then sequentially compare with the remaining elements; max changes only when a larger value is found. The same logic applies for 5, 50, or 1000 numbers.

Components of an algorithm

Flow types: sequential, selection, iterative

Sequential logic: statement 1, then 2, then 3, then 4 … executed one by one with no change in flow. Selection (conditional) logic: flow depends on meeting criteria — switch: if a condition holds, statement one executes, otherwise statement two; if nothing executes, default executes. Variants: single alternative (if-else), double alternative (if, else-if, else), multiple alternatives (switch). Iterative (repetitive) logic: the same thing appears again and again up to some condition; simple examples are loops (for, while).

Algorithmic analysis: efficiency and scalability

Algorithmic analysis evaluates performance in terms of efficiency and scalability — how efficient an algorithm is, which of multiple algorithms is more efficient, and what happens when it is scaled to a larger extent (input increases). Primary goal: understand how an algorithm behaves as input size increases. Common approach: measure running time as a function of input size; f(n) denotes the algorithm where n is the input. Theoretical analysis is needed because testing on random input sets is unreliable (an algorithm tested on 10,000 inputs may fail at one million; a website fine for 5,000 simultaneous users fails at 20,000). Two critical factors determine computational complexity: input size and the dominating operation. In searching and sorting, comparison is the dominating/key operation — it costs more because it converts both digits to binary, compares digit by digit, then declares the number, whereas assignment and addition cost lower; for larger n the other operations can be omitted. Other factors (not the primary focus): memory use, parallelism, heuristics, other optimization techniques. Time and space are the two main measures of efficiency: time is measured by counting key operations, space by the maximum memory needed. The complexity of an algorithm M is a function f giving the running time and storage requirement in terms of input size.

Formulas and maths

Worked examples

Mod examples:

Congruence example: a = 11, b = 17, n = 2. 11 mod 2 = 1 and 17 mod 2 = 1, so 11 ≡ 17 mod 2. Check: b − a = 17 − 11 = 6, and 6 ÷ 2 = 3 with remainder 0, so n divides b − a.

Integer/absolute examples: int 3.14 = 3; int √5 = 2; int −8.5 = 8 (as stated in class).

Factorial example: 5! = 5 × 4! = 5 × 4 × 3! = 5 × 4 × 3 × 2! = 5 × 4 × 3 × 2 × 1! = 5 × 4 × 3 × 2 × 1 × 0! = 5 × 4 × 3 × 2 × 1 × 1 = 120.

Fibonacci example: f(0) = 0, f(1) = 1; f(2) = 0 + 1 = 1; f(3) = 1 + 1 = 2; f(4) = 2 + 1 = 3 (transcript garbled here — [unclear]); series continues 1, 1, 2, 3, 5, 8, 13, …

Polynomial example 1: a·n⁶ + b·n⁵ + c·n⁴ + d·n² + 39 (coefficients a, b, c, d; no n³ or n¹ terms). Written as Σ (i = 0 to 6) a_i · n^i. Expanding: a₀ = 39, a₁ = 0, a₂ = d, a₃ = 0, a₄ = c, a₅ = b, a₆ = a. Stored coefficients: a₆, a₅, a₄, a₂, and a₀ = 39.

Polynomial example 2 (quadratic): a·n² + b·n + c = 0: a₂ = a, a₁ = b, a₀ = c. As summation: Σ (i = 0 to 2) a_i · n^i = a₀n⁰ + a₁n¹ + a₂n² = c + bn + an², which rearranges to an² + bn + c.

Polynomial example 3: 3x² + x + 1: a₀ = 1, a₁ = 1, a₂ = 3. Coefficient array: 1, 1, 3. Recreation: a₀x⁰ + a₁x¹ + a₂x² = 1 + x + 3x².

Polynomial example 4: 6x⁴ + x + 2: coefficients a₀ = 2, a₁ = 1, a₂ = 0, a₃ = 0, a₄ = 6. Coefficient array: 2, 1, 0, 0, 6. Recreation: a₀x⁰ + a₁x¹ + a₂x² + a₃x³ + a₄x⁴ = 2 + x + 0 + 0 + 6x⁴.

Largest element example: array 31, 20, 21, 7, 47 (array name data). Compare 31 with 20 → highest 31; 31 with 21 → 31; 31 with 7 → 31; 31 with 47 → 47. Location = 5. (The transcript's comparison sequence is slightly garbled; the final result given is max 47 at location 5.) Algorithm as described: a non-empty array data with n numerical values is given; find the location loc and the value max of the largest element. Initialize location k = 1 and max = data at location 1. Set counter k = 2. Stopping criterion: if k > n, stop and output location, max, and exit. Otherwise, if max < data[k], then location = k and max = data[k].

Quadratic procedure steps: Step 10: take the values of a, b, c supplied/input by the user. Next step: estimate d (discriminant) = value under root of b² − 4ac. Third step: check if d == 0 (one unique solution), else if d > 0 (two solutions), else (d < 0) no solution.

Imaginary-root example: 2x² + 4x + 9: b² − 4ac = 16 − 4·2·9 = 16 − 72, negative inside the root → imaginary value; this lands in the third case (d < 0), declared "no solution" in the procedure, but an imaginary result can be obtained using the imaginary number concept. (The transcript also contains a garbled remark "16 minus 72 of course will be 50 minus 56" — [unclear].)

Website example: website declared fine for 5,000 simultaneous users; 20,000 users accessing it makes it difficult — illustrating why testing on finite input sets is not sufficient.

Sorting example: ~100 records with insertion sort; with a 30-second clock and 1 million records, insertion sort will not finish in time, while merge sort takes lower time.

Chunking example: 100 students' marks; chunk into 10, 10, 10, 10, sort each chunk, then merge (divide and conquer / merge sort) — lower time than picking one copy at a time and comparing with all.

Questions asked in class

Transcript

One line per segment, [hh:mm:ss] timestamp first.

loading…