Save this video — free

CS50 Fall 2025 - Lecture 5 - Data Structures (live, unedited)

CS50 · 2:35:10 · Watch on YouTube

CS50 Fall 2025 - Lecture 5 - Data Structures (live, unedited) Watch on YouTube →

Overview

CS50's Lecture 5 explores fundamental data structures in C, contrasting arrays with linked lists and introducing abstract data types like stacks and queues. The lecture details memory management with `malloc`, `realloc`, and `free`, demonstrating dynamic array resizing and the implementation of linked lists. It then delves into binary search trees and hash tables, highlighting trade-offs between space, time complexity, and implementation complexity, culminating in a discussion of tries for achieving near-constant time lookups.

Key takeaways

Chapters

14:05 Introduction to Data Structures: Stacks and Queues
16:54 Implementing Queues and Stacks with Arrays
20:00 Dictionaries as Abstract Data Types
20:36 Arrays: Contiguous Memory Allocation
24:30 Dynamic Memory Allocation with `malloc`
26:20 Pointer Arithmetic and Array Equivalence
29:30 Resizing Dynamically Allocated Memory: `realloc`
35:00 Memory Leaks and `free()`
40:15 Linked Lists: Dynamic Data Structures
44:20 Implementing Linked List Nodes
49:00 Building a Linked List: Prepending Nodes
52:15 Traversing and Printing a Linked List
54:20 Linked List Insertion: Appending and Sorted Order
58:20 Handling Insertion Scenarios in Linked Lists
1:02:00 Freeing Linked List Memory
1:09:00 Recap: Arrays vs. Linked Lists
1:17:30 Binary Search Trees (BSTs): Combining Speed and Dynamism
1:20:00 BST Search Algorithm (Recursive)
1:23:20 BST Challenges: Balancing and Degeneration
1:28:00 Hashing: Mapping Infinite to Finite Domains
1:29:00 Hash Function Implementation
1:31:00 Hash Tables: Arrays of Linked Lists
1:34:00 Hash Table Collisions and Trade-offs
1:40:00 Tries: Achieving Constant Time Lookups
1:42:00 Trie Implementation and Lookup
1:44:00 Trie vs. Hash Table: Space vs. Time
1:45:00 Real-World Hashing: Sweetgreen Example
1:46:40 Final Data Structures and Problem Set 5

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

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.