Save this video free

Edit Distance and Matrix Chain Multiplication

Kent Quanrud · 1:14:36 · Watch on YouTube

Part of Purdue University Fundamental Algorithms (Fall 2026). See all 20 lectures and search them

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

Overview

Kent Quanrud develops two dynamic-programming algorithms from conservative recursive specifications: edit distance and matrix-chain multiplication. Memoizing the edit-distance suffix pairs yields an O(mn) algorithm, while splitting matrix intervals at every possible final multiplication yields an O(k³) algorithm for k matrices.

Key takeaways

Chapters

0:00 String Distance Applications: Git Diff and DNA Sequences
3:15 Hamming Distance and Error-Correcting Codes
5:45 Edit Distance: Insertions, Deletions, and Replacements
7:00 Metric Properties and the Triangle Inequality
11:14 Why Edit Distance Models Misalignment Better Than Hamming Distance
14:00 Searching for a Correct Recursive Edit-Distance Algorithm
19:27 Edit-Distance Specification and Empty-String Base Cases
23:17 Three First-Character Choices for Edit Distance
30:00 The Exponential Recursion and Its Repeated Subproblems
40:30 Memoizing Suffix Pairs Produces an O(mn) Algorithm
45:00 Dynamic-Programming Solution Expectations and Proofs
55:21 Matrix Multiplication Cost Depends on Parenthesization
1:00:00 Parenthesization Trees Reveal Matrix-Chain Subproblems
1:07:00 Interval Recurrence and the O(k³) Matrix-Chain Algorithm

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

Transcript excerpt

0:05 Okay. So, so today we're going to do um edit distance and and matrix chain multiplication. Um but let's see. Okay. So, all right. So, the first problem is about uh measuring distances between strings. So, let me first give some some applications that you've probably seen and thought of before. So, uh this is like uh GitHub. I guess you must all use GitHub and of course uh as you know uh you update some files and uh and GitHub will highlight like the differences and stuff like this. Uh do you guys know what GitHub uses to highlight the lines? How it does it? So there's a Unix command called diff. So git is built on just diff. Uh and I think it's actually going to try to it

0:54 doesn't really distinguish letters. It tries to match lines. uh to each other. Okay. Anyway, so there's something called diff. It's been around forever. At some level, we're going to implement diff today. Uh and maybe another example of like uh wanting to know how different strings are. Oh, this is this is diff. And uh another example uh might come up is like genetics if you're in like computational biology. So I'm not really a great biologist but uh presumably you know we're all made up of these kind of genetic codes that sort of give you all your personalities and features and there's four letters AC G and T with complimentary letters and things like this and some cool you know double helix structure and uh you know computational biologists are often interested in like

1:41 okay I have two different genetic sequences from two different people two different flies two different viruses or something they you know they want to know how different or similar uh they

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

In this course

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, Kent Quanrud.

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.