Sunday, July 5, 2026
SAVED POSTS
  • Login
  • Register
RathBiotaClan
No Result
View All Result
  • HOME
  • HEALTH SCIENCE

    TRENDING ON HEALTH (TOP)

    Fick Method Underestimates Heart Problems in Children After Heart Transplant, Study Finds

    For Women on Antidepressants, Creatine Showed a Possible Extra Boost

    Did the iPhone Quietly Reshape When and Whether Americans Have Children?

    For People Antidepressants Never Helped, a 30-Minute Home Session Is Now FDA-Approved

    NOW ON AIR (RBC)

    Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment
    BIOINFORMATICS

    Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment

    July 4, 2026
    BIOINFORMATICS

    Gaps in Sequence Alignment and Their Role in cDNA Matching

    July 4, 2026
    Local Alignment: Finding Substrings of High Similarity
    BIOINFORMATICS

    Local Alignment: Finding Substrings of High Similarity | Notes

    July 4, 2026
    BIOINFORMATICS

    Weighted Edit Distance Explained: Operation-Weight & Alphabet-Weight (Notes)

    July 4, 2026
  • NEUROSCIENCE
    • PHYSIOLOGY
    • IMMUNOLOGY
    • CANCER
  • DISCOVERIES
    • SPOTLIGHTS
    • STUDENT PORTAL
    • SCIENCE FEATURED
  • MOLECULAR BIOLOGY
    • GENETICS
    • BIOTECHNOLOGY
    • BIOINFORMATICS
    • BIOCHEMISTRY
    • BIOPHYSICS
  • ZOOLOGY & ECOLOGY
    • ENVIRONMENTAL SCIENCE
    • ECOLOGY
    • EVOLUTION
  • MICRO & PLANT SCIENCE
    • MICROBIOLOGY
    • CELL BIOLOGY
    • DEVELOPMENTAL BIOLOGY
  • PSYCHOLOGY
RathBiotaClan
RathBiotaClan
No Result
View All Result
Home BIOINFORMATICS

Dynamic Programming Approach to Edit Distance Calculation

Shibasis Rath by Shibasis Rath
July 4, 2026
in BIOINFORMATICS, STUDENT PORTAL
Reading Time: 4 mins read
0
A A
0

Edit distance between two strings is the minimum number of edit operations (insertion, deletion, replacement, match) required to transform one string into another. It is computed using dynamic programming, which has three components: the recurrence relation, the tabular computation, and the traceback. This answer explains the definition of the problem and the derivation and proof of the recurrence relation.

Definition of D(i, j)

For two strings S1 and S2, D(i, j) is defined as the edit distance between the first i characters of S1, that is S1[1..i], and the first j characters of S2, that is S2[1..j]. If S1 has n characters and S2 has m characters, the edit distance between the complete strings is D(n, m). Instead of computing D(n, m) directly, dynamic programming solves D(i, j) for all values of i from 0 to n and j from 0 to m, building up to the final answer.

Base Conditions

  • D(i, 0) = i, since the only way to convert i characters of S1 into zero characters is to delete all of them.
  • D(0, j) = j, since j insertions are needed to build S2’s first j characters from an empty string.

The Recurrence Relation

When both i and j are strictly positive:

D(i, j) = min [ D(i−1, j) + 1, D(i, j−1) + 1, D(i−1, j−1) + t(i, j) ]

ADVERTISEMENT

where t(i, j) = 0 if S1(i) = S2(j), and t(i, j) = 1 if S1(i) ≠ S2(j).

READ ALSO

Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment

Gaps in Sequence Alignment and Their Role in cDNA Matching

Correctness of the Recurrence Relation

Correctness is proved using the idea of an edit transcript, a sequence of symbols (I, D, R, M) representing the operations used. The proof has two parts.

ADVERTISEMENT

Lemma 1 — D(i, j) must be one of the three values

Considering the last symbol of an optimal transcript transforming S1[1..i] into S2[1..j]:

ADVERTISEMENT
  • If it is Insertion (I), the earlier part of the transcript optimally transforms S1[1..i] into S2[1..j−1], so D(i, j) = D(i, j−1) + 1.
  • If it is Deletion (D), the earlier part transforms S1[1..i−1] into S2[1..j], so D(i, j) = D(i−1, j) + 1.
  • If it is Replacement (R) or Match (M), the earlier part transforms S1[1..i−1] into S2[1..j−1], giving D(i, j) = D(i−1, j−1) + t(i, j), since t(i, j) unifies both cases (0 for match, 1 for replacement).

As every transcript must end in one of these four symbols, D(i, j) can only take one of these three values.

Lemma 2 — D(i, j) is at most the minimum of the three values

Each of the three values can be shown to correspond to an actual feasible transformation:

  • D(i, j−1) + 1: optimally transform S1[1..i] to S2[1..j−1], then insert S2(j).
  • D(i−1, j) + 1: optimally transform S1[1..i−1] to S2[1..j], then delete S1(i).
  • D(i−1, j−1) + t(i, j): optimally transform S1[1..i−1] to S2[1..j−1], then match or replace the last character as needed.

Since all three are feasible, their minimum is also feasible, so D(i, j) ≤ minimum of the three values.

Theorem

Combining Lemma 1 (D(i, j) must equal one of the three values) and Lemma 2 (D(i, j) is ≤ the minimum of the three values), it follows that D(i, j) is exactly equal to the minimum:

D(i, j) = min [ D(i−1, j) + 1, D(i, j−1) + 1, D(i−1, j−1) + t(i, j) ]

Significance

This recurrence relation, along with the base conditions, allows D(i, j) to be computed using only smaller previously solved values, forming the basis for the tabular computation of the full distance matrix and the traceback to recover the optimal edit transcript.

  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Facebook (Opens in new window) Facebook
  • Share on Reddit (Opens in new window) Reddit
  • Share on X (Opens in new window) X
  • Print (Opens in new window) Print
Shibasis Rath

Shibasis Rath

"𝓒𝓸𝓷𝓷𝓮𝓬𝓽𝓲𝓷𝓰 𝓡𝓮𝓼𝓮𝓪𝓻𝓬𝓱 𝓣𝓸 𝓡𝓮𝓪𝓵𝓲𝓽𝔂" 𝓲𝓼𝓷'𝓽 𝓙𝓾𝓼𝓽 𝓪 𝓜𝓸𝓽𝓽𝓸 - 𝓘𝓽'𝓼 𝓜𝔂 𝓜𝓲𝓼𝓼𝓲𝓸𝓷

Related Posts

Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment
BIOINFORMATICS

Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment

July 4, 2026
Gaps in Sequence Alignment and Their Role in cDNA Matching
BIOINFORMATICS

Gaps in Sequence Alignment and Their Role in cDNA Matching

July 4, 2026
Local Alignment: Finding Substrings of High Similarity
BIOINFORMATICS

Local Alignment: Finding Substrings of High Similarity | Notes

July 4, 2026

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

POPULAR NEWS

Chewing gum releases thousands of microplastic particles directly into your mouth with every piece you chew

Chewing gum releases thousands of microplastic particles directly into your mouth with every piece you chew

by Shibasis Rath
May 8, 2026
0

Microplastics are turning up in places researchers never expected: deep-sea sediments, Arctic ice, and human blood. Now, a UCLA pilot...

woman in white tank top lying on bed

New Studys Says Gen Z is the least sexually active young cohort in modern recorded history

by Shibasis Rath
January 24, 2026
0

A generation that grew up with dating apps in their pockets, pornography a tap away, and sex discussed more openly...

grayscale photo of girl in polka dot long sleeve shirt

Yelling Isn’t Just Yelling: How a Hostile Home Rewires a Child’s Brain for Constant Alert

by Shibasis Rath
March 8, 2026
0

To a parent in the heat of the moment, a raised voice may feel like simple frustration. To a child...

a group of gen Z kids walking down a street

Is Gen Z the First Generation Less Intelligent Than Their Parents?

by Shibasis Rath
February 5, 2026
0

Gen Z intelligence decline is emerging as a serious concern among neuroscientists and education researchers. For over a century, each...

72-Hour Fasting Can Reset Your Entire Immune System, USC Study Shows

72-Hour Fasting Can Reset Your Entire Immune System, USC Study Shows

by Shibasis Rath
February 28, 2026
0

A 72-hour fast can trigger a powerful immune system reset. Scientists call this stem cell regeneration. The process clears old...

EDITOR CHOICE‘S

  • All
  • NEWS
  • SPOTLIGHTS
Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment

Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment

by Shibasis Rath
July 4, 2026
0

In alignment problems, the use of gaps in the objective function helps in finding alignments that satisfy an expected shape,...

Gaps in Sequence Alignment and Their Role in cDNA Matching

Gaps in Sequence Alignment and Their Role in cDNA Matching

by Shibasis Rath
July 4, 2026
0

In the study of string alignment and dynamic programming, the basic elements used to evaluate an alignment are matches, mismatches,...

Local Alignment: Finding Substrings of High Similarity

Local Alignment: Finding Substrings of High Similarity | Notes

by Shibasis Rath
July 4, 2026
0

Sequence comparison is one of the fundamental problems in computational biology and string algorithms. While global alignment compares two strings...

Weighted Edit Distance Explained: Operation-Weight & Alphabet-Weight (Notes)

Weighted Edit Distance Explained: Operation-Weight & Alphabet-Weight (Notes)

by Shibasis Rath
July 4, 2026
0

Edit distance measures how many insertions, deletions, and substitutions are required to transform one string into another. The basic edit...

ADVERTISEMENT

RathBiotaClan – RBC

RathBiotaClan – Connecting Research To Reality

Your trusted source for life science news, biology research & discoveries. Covering neuroscience, genetics, ecology, and more — connecting research to reality.

About Us

Privacy Policies

Contact Us

Editorial Standard

Latest Posts

  • Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment
  • Gaps in Sequence Alignment and Their Role in cDNA Matching
  • Local Alignment: Finding Substrings of High Similarity | Notes
  • Weighted Edit Distance Explained: Operation-Weight & Alphabet-Weight (Notes)

SHIBASIS RATH

Contact Mail

rathbiotaclan@gmail.com

No Result
View All Result
MSME (Udyam) Certified Science Platform
Govt. of India

Get Us On PlayStore

playstore app for rathbiotaclan
  • About Us
  • Advertise With Us
  • Cancellation and Refund Policy
  • Contact Us
  • Contribute
  • Editorial Standards
  • Home
  • Pricing Details
  • Privacy Policies
  • Shipping Policy
  • Terms & Conditions

© 2026 RathBiotaClan. All rights reserved.

Welcome Back!

Sign In with Google
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Google
OR

Fill the forms below to register

*By registering into our website, you agree to the Terms & Conditions and Privacy Policy.
All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

No Result
View All Result
  • HOME
  • HEALTH SCIENCE
  • NEUROSCIENCE
    • PHYSIOLOGY
    • IMMUNOLOGY
    • CANCER
  • DISCOVERIES
    • SPOTLIGHTS
    • STUDENT PORTAL
    • SCIENCE FEATURED
  • MOLECULAR BIOLOGY
    • GENETICS
    • BIOTECHNOLOGY
    • BIOINFORMATICS
    • BIOCHEMISTRY
    • BIOPHYSICS
  • ZOOLOGY & ECOLOGY
    • ENVIRONMENTAL SCIENCE
    • ECOLOGY
    • EVOLUTION
  • MICRO & PLANT SCIENCE
    • MICROBIOLOGY
    • CELL BIOLOGY
    • DEVELOPMENTAL BIOLOGY
  • PSYCHOLOGY
  • Login
  • Sign Up
SAVED POSTS

© 2026 RathBiotaClan. All rights reserved.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.