Skip to content

In the Edit Distance problem, we need to find the minimum number of edits or operations required to make two strings equal.

Notifications You must be signed in to change notification settings

mehboobali98/Edit-Distance-DP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Edit Distance Dynamic Programming

Problem Statement

In Edit Distance problem, we need to find the minimum number of edits or operations required to make two strings equal. The avaiable operations are:

  • Insertion
  • Deletion
  • Replace

The solution to this problem is not unique. i.e. multiple optimal solutions are possible. Hence, we need to find count of all possible unique optimal solutions. For example:

𝑠 = TREE and 𝑡 = TOR, and four optimal solutions are possible, each having cost 3.

Approach

The algorithm to solve the problem has been implemented in three ways:

  • recursive
  • top-down
  • bottom-up (Dynamic Programming)

Time Complexity

The time complexity of the dynamic programming solution is: O(N^2)

Directory Structure

📦Edit-Distance-DP
┣ 📜main.cpp
┗ 📜README.md

About

In the Edit Distance problem, we need to find the minimum number of edits or operations required to make two strings equal.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published