Lecture 1: Algorithmic Thinking, Peak Finding
Why Stack Overflow recommends it
Stack Overflow users link it when asking or explaining why the divide-and-conquer (binary search style) peak finding algorithm works and how its recurrence T(n)=T(n/2)+O(1) arises.
Recommended by 2 people across 2 different months, 2014 to 2025.
What it is
The opening lecture of MIT 6.006 Introduction to Algorithms (Fall 2011), taught by Srini Devadas. It introduces algorithmic thinking through the peak finding problem, covering a straightforward linear scan and a divide-and-conquer approach for 1D arrays, then extending to 2D.
What people said
Recommends thegamerguy · 2022-11 · Stack Overflow · on “MIT's Lecture 1: Algorithmic Thinking, Peak Finding - How does this Divide & Conquer Algorithm work?”
I am looking at the lecture at [this video] 27:22 - 32:50, particulary 28:17 to 31:01 where the teacher explains the divide-and-conquer algorithm for finding a peak in an array: [LINK] Divide and conquer: 1 2 n/2-1 n/2 n/2+1 n-1 n ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ │ │ │ ... │ │ │ │ ... │ │ │ └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ ↑ Look at n/2 position if a[n/2] < a[n/2-1] then only look at left half 1...n/2-1 to look for a peak. Else if a[n/2] < a[n/2+1] then only look at right half n/2+1...n to look for a peak. Else n/2 position is a peak. I don't quite understand the above if...else logic. If we take the first if/else case, why does the teacher claim that
Recommends Ehtesh Choudhury · 2025-01 · Stack Overflow · on “How to find peak elements in an array when there are multiple peaks?”
For anyone interested in more commentary/discussion, there's a leetcode problem on this topic: [LINK] as well as an MIT lecture from the algorithms course: [this video]
Cites Ritesh · 2014-11 · Stack Overflow · on “1-D Peak Finding Algorithm for Multiple Peaks”
Currently I'm referring to the explanation given for finding a peak in 1-D array at below video tutorial by MIT OpenCourseWare. [this video] The recurrence relation : T(n)=T(n/2) + O(1) emphasizes only on one half of array plus it will result into one peak as an output. What could have been the recurrence relation having said that multiple peak do exist. Please someone put some light on this query. Thanks in advance !
Cites Oscar Ortiz García · 2020-07 · Stack Overflow · on “Why does the binary search algorithm works for this 1D" Peak finding" problem?”
I was looking into MIT's open courseware first lecture on an introduction to algorithms and there is something that is not terribly obvious to me. You cant start watching the lecture at 24:30 here [this video] and the lecture notes with all the details of the 1D peak problem definition and solution in here [LINK] The problem goes: for an array of "n" integer elements find a peak and gives an example array of size 8: example = [6,7,4,3,2,1,4,5] Definition of a peak For the example array above example[1] and example[7] are "peaks" because those numbers are greater or equal than their adjacent element and a special condition for the last element of the array applies that it only needs to be greater