classnotes RTX 4070 Ti SUPER · faster-whisper · DeepSeek

5101 - Design & Analysis of Algo

← 5101 - Design & Analysis of Algo

DAA_04 Oct_lab

Date 2026-10-04 Length 1h 21m Words 6,975 Segments 456
⤓ Download transcript (.txt with timestamps) ⤓ Plain transcript (.txt) ⤓ Transcript (.md)

Summary


session: "5101-design-analysis-of-algo/2026-10-04 0000 DAA 04 Oct lab"

title: "DAA 04 Oct lab"

date: "2026-10-04 00:00"

duration: "1h 20m"

language: "en"

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

parts: 2

transcript_chars: 34751

generated: "2026-11-23T23:53:33+05:30"


DAA 04 Oct lab

Overview

This class covered bubble sort in detail — its definition, why it is called "bubble" sort, passes and comparisons, counting swaps, writing the code, and tracing it on small examples — and then moved to the closest pair of points problem using a divide-and-conquer approach (left half, right half, cross pairs). A platform issue with sample test cases not visible while running code was raised and fixed. The later part of the session surveyed AI/DS learning resources: vision-language models and vision transformers, interactive neural network and CNN visualization demos, image generation origins (diffusion, Brownian motion, energy-based models), and recommended books/sites. The class ended with an unanswered student question about the instructor's approach to the algorithm problem, deferred to later.

Learning outcomes

Core concepts

Bubble sort

A simple sorting algorithm that repeatedly compares adjacent elements and swaps them if they are in the wrong order (if the left element is greater than the right element, swap them). It matters as the baseline sorting algorithm for the course and the basis of the swap-counting problem. It connects to the lab challenge where students count the number of swaps needed to sort an array.

Why "bubble"

During every pass, the largest unsorted element gradually "bubbles up" to the end of the array. Analogy given: in water, the larger bubble goes up first; also compared to the film Secret Superstar, where bubbles go up. This explains the name and why the last position is fixed after pass 1.

Pass

One full sweep of adjacent comparisons. After pass 1, the largest element is guaranteed to be in its correct (last) position. There is no guarantee the array is sorted after pass 1, so passes continue until the array is sorted.

Not re-comparing sorted elements (better version)

After each pass, one more element is already in its correct position, so it does not need to be compared again. This is why the inner loop uses n - i - 1 — the "better version" of bubble sort. The n - 1 bound exists to avoid comparing out of index (array out of index error), since each element is compared with its adjacent (next) element.

Swap counter

A variable num_swaps initialized to 0, incremented by 1 after each swap, to count how many swaps happen during the sort. This is the quantity the lab problem asks for.

Closest pair of points problem

Given n points, each represented by coordinates x and y, find the minimum Euclidean distance between any two distinct points (not the same point). It motivates the divide-and-conquer technique covered next.

Euclidean distance

The distance between (x1, y1) and (x2, y2) is the square root of (x2 − x1)² + (y2 − y1)². It is the distance measure used throughout the closest-pair algorithm.

Divide-and-conquer for closest pair

Divide the points into left and right halves; compute the minimum distance within the left half and within the right half; compare the two to get the minimum. This is not sufficient by itself — pairs that cross the dividing line must also be checked, and if a cross-pair distance is smaller, it becomes the new minimum. The points are sorted by coordinates (the reason is stated as something to be explained: "I'll tell you why I'm sorting").

VLM and vision transformers

The instructor notes the earlier material was likely for the LLM, and this part is for the VLM, where the vision transformer starts — you are given an image size of a section/cross-section and pass that image into other transformations.

Neural network basics and demos

Basics to know: learning rate, activation function, regularization, and problem type (classification or regression). In the classification demo (classifying between two points), you can watch the error/training loss going down and see how many epochs it takes to classify; you can see which neuron/what part is classified and play with activation functions (e.g., sigmoid) and depth.

CNN demo and filters

A multi-class digit classification demo (digits 0, 1, 2, 3, 4, 7, 8, 9): drawing an 8 is properly classified as an 8. The visualization shows how each layer detects edges — the first layer calculates certain edges, the second layer calculates other edges and the below edges, the third layer calculates upper edges, while also reducing the inner size, and finally it is classified as an 8. A filter is used to calculate edges: a top-edge filter produces the red part (top edge); a right-edge filter produces the red side on the very right. You do not need to memorize values like minus one, zero, minus one, zero — you can look them up. The image is converted into zeros and ones — only two channels, not RGB; zero means black, one means white.

Max pooling and padding

Max pooling is "nothing but reducing the image size" — making it smaller. The instructor asks you to question whether reducing the image matters, since a high-resolution image would clarify better for the machine than a lower-resolution one, and to ask GPT what the reason behind reducing is. Padding is a method to avoid cutting down the image — "padding add, reduce ho ke bhi" (even after reducing, add padding), so the image is not cut down.

Image generation origins

Image generation came from physics — diffusion, and before diffusion, Brownian motion — introduced into "image energy" things, which are also called energy-based models. Knowledge distillation and dropout are attributed to the "godfather of AI"; the instructor calls this a very, very important website.

Formulas and maths

Worked examples

Bubble sort, example array 5, 3, 8, 4, 2 (expected sorted: 2, 3, 4, 5, 8)

Pass 1 trace:

Pass 2: the last element is not compared again; after pass 2 the next largest element reaches its position (the instructor says "five will reach to this position" — see flagged items).

Bubble sort, second example with 3 elements: 6, 4, 1

Closest pair example

4 points (the transcript mentions coordinates like (−5, 4) and (−5, −4) as an illustration of points on either side of a division); the algorithm computes left minimum, right minimum, then cross-pair minimum, and takes the overall minimum.

Neural network / CNN demos

Questions asked in class

A (instructor): Checked the challenge page; test cases are there. The issue appears when running the code (not submitting). After the instructor's fix, submitting should show input 00 as the first test case and it will be checked. The instructor apologized for the issue (mentioning AWS storage, region us-east-1) and asked students to resubmit.

A (instructor): It's already open; you can submit it.

A (instructor): You can run it yourself and understand; the code was already shown.

A (instructor): "that's a very, okay, let me go through, again." (The instructor then says he is stopping the recording because he doesn't know this, and the class ends.)

Key takeaways

Exam-style questions

Glossary

Follow-ups

Transcript

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

loading…