Save this video free

CS50 Fall 2025 - Lecture 3 - Algorithms (live, unedited)

CS50 · 2:32:55 · Watch on YouTube

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

CS50's Lecture 3 introduces fundamental algorithms, starting with a human-powered attendance count demonstrating linear and logarithmic time complexity. The lecture then delves into linear search (O(n)) and binary search (O(log n)) using "lockers" and "money" as metaphors, before explaining Big O notation for analyzing algorithm efficiency. It also covers selection sort, bubble sort (both O(n^2)), and the more efficient merge sort (O(n log n)), highlighting recursion as a powerful technique for solving complex problems like drawing Mario pyramids.

Key takeaways

Chapters

17:48 Introduction to Algorithms and Time Complexity
20:30 Human-Powered Attendance Algorithm
26:20 Analyzing Algorithm Efficiency: Linear vs. Logarithmic Growth
28:40 Understanding Arrays and Memory Access
34:50 Linear Search: Finding a $50 Bill
35:20 Binary Search: Leveraging Sorted Data
37:15 Pseudocode for Linear Search
38:30 Pseudocode for Binary Search
44:20 Big O Notation: Analyzing Running Time
48:20 Implementing Linear Search in C (Integers)
59:20 Implementing Linear Search in C (Strings)
1:09:10 Implementing a Phone Book with Structs in C
1:21:00 Analyzing Selection Sort
1:40:10 Analyzing Bubble Sort
1:49:00 Visualizing Sorting Algorithms
1:59:00 Introduction to Recursion
2:14:00 Merge Sort: Divide and Conquer

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

18:43 s. Why Why Yeah.

19:35 What. All right, this is CS 50. This is week 3, and this was an artist's rendition of what various sorting algorithms look and sound like. Recall from week 0 that an algorithm is just step by step instructions for solving some problem to sort information as in the real world just means to order it from like smallest to largest or alphabetically or some other heuristic, and it's among the algorithms that we're going to focus on today in addition to searching, which of course is looking for. As we did in week 02. Among the goals for today are to give you a sense of certain computer science building blocks like there's a lot of canonical algorithms out there that most anyone who studied computer science would know, anyone who leads a tech interview would ask. But more importantly, the goal is to give you different mental models for and methodologies for actually solving problems by giving you a sense of how these real world algorithms

20:25 can be translated to actual computers that you. I can control. We thought we'd begin today with an actual algorithm for sort of taking attendance. We of course do this with scanners outside, but we can do it old school whereby I just use my hand or my mind and start doing 123456789, 1011, 12, and so forth. That's going to take quite a few steps because I've got to point at and recite a number for everyone in the room. So I could kind of do what my like grade school teachers taught me, which is count by 2s, which would seem to be faster. Like 2468, 1012, 1416, 1820, and clearly that sounds and is actually faster, but I think with a little more intuition and a little more thought back to week zero,

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, CS50.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.