DSA-1 CO4 | Week 7 Lecture 1 | Part 2/6 | Binary-search contracts and insertion points
Chaitanya Kumar
0:00 / 0:00
DSA-1 CO4 | Week 7 Lecture 1 | Part 2/6 | Binary-search contracts and insertion points
0 просмотров · 6 дн. назад
Chaitanya Kumar
7 подписчиков
0 просмотров · 6 дн. назад
DSA-1 (26SC1203E) - revised two-weeks-per-CO sequence.
CO4: teaching Weeks 7-8.
Week 7, Lecture 1: Binary-search contracts and insertion points.
Part 2 of 6; slides 3-6. Watch the numbered parts in order.
Local SvaraCraft M1 narration, timed yellow/cyan annotations and English captions. Follow the guided pauses and write your own predictions, tests and reasoning. Student-lab solutions and private answer keys are excluded. Narration uses an AI-generated voice.
Teaching materials: https://chaitanyakumar.in/dsa1
University SLM: https://y26btech.klef.in/slm/26SC1203...
Original SLM week numbers identify source readings; the revised teaching plan governs delivery.
Chapters
00:00 Slide 3 / Linear scan: test positions until equality
00:21 Slide 3 / This example: 8 linear tests / 4 binary probes
00:45 Slide 3 / Closed candidates: [left,right]; discard failed middle
01:09 Slide 3 / Empty candidates to -1 / sortedness enables halving
02:23 Slide 4 / middle = left + (right-left)/2
02:48 Slide 4 / With left=0,right=1: middle=0; left=middle stalls
03:07 Slide 4 / A singleton must be tested, then returned or excluded
03:28 Slide 4 / Preserve candidates / valid access / strict progress
04:37 Slide 5 / Start [0,5]: middle=2, value=3
04:54 Slide 5 / Discard 0..2; next candidates [3,5]
05:14 Slide 5 / middle=4, value=9 to return index 4
05:32 Slide 5 / Return an index / failed search will return -1
06:40 Slide 6 / Initialize [0,n-1]; loop while left at most right
07:00 Slide 6 / Equality to return / failure to move past middle
07:20 Slide 6 / Empty input skips access / singleton gets one test
07:42 Slide 6 / Any equal index / first occurrence needs a boundary