Algorithms and Data Structures · Senior · Question 36 of 75

Which algorithm do git diff and many diff tools use by default?

Explanation

Myers finds the shortest sequence of insertions and deletions in O((n + m) × d), where d is the number of differences, so similar files diff quickly. It's closely related to the longest common subsequence.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 36

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz