Thursday, December 3, 2026
SAVED POSTS
  • Login
  • Register
RathBiotaClan
No Result
View All Result
  • HOME
  • HEALTH SCIENCE

    TRENDING ON HEALTH (TOP)

    A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy

    Targeted Radiation Therapy Slows Disease Progression in Advanced Prostate Cancer

    Laughter therapy may help people with a common form of lung disease

    Mindfulness Therapy Offers New Hope for People Stuck in Depression

    NOW ON AIR (RBC)

    fruitfully remove the head, then touch the wing
    NEUROSCIENCE

    Fruit Flies Without Heads Keep Cleaning Their Wings, Scientists Found the Cells Behind It

    November 30, 2026
    HEALTH SCIENCE

    A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy

    November 29, 2026
    prostate-cancer
    CANCER

    Targeted Radiation Therapy Slows Disease Progression in Advanced Prostate Cancer

    November 27, 2026
    BIOTECHNOLOGY

    Scientists Reveal How CRISPR Systems Recruit Enzymes for Precise DNA Insertion

    November 26, 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
Loading…
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
5
A A
0
ADVERTISEMENT

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:

Advertisement

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

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

READ ALSO

Multiple alignment with sum of pairs and consensus objective functions

Why Is Multiple String Alignment Harder Than Pairwise Alignment?

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.

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:

Advertisement

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.


Discover more from RathBiotaClan

Subscribe to get the latest posts sent to your email.

Previous Post

Negotiating with women builds more trust, even in anonymous online chats, Study finds

Next Post

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

Shibasis Rath

Shibasis Rath

Shibasis Rath is the founder and editor of RathBiotaClan. He holds a B.Sc. in Zoology and a master's degree in Bioinformatics, and writes about genetics, evolution, zoology and the wider life sciences, turning peer-reviewed research into clear, accurate news for general readers.

Every article links to the original study, and health stories are written as research summaries, not medical advice.

RathBiotaClan: Connecting research to reality.

Related Posts

Multiple alignment with sum of pairs and consensus objective functions
BIOINFORMATICS

Multiple alignment with sum of pairs and consensus objective functions

November 19, 2026
Why Is Multiple String Alignment Harder Than Pairwise Alignment?
BIOINFORMATICS

Why Is Multiple String Alignment Harder Than Pairwise Alignment?

November 19, 2026
Multiple Sequence Comparasion For Structural Interference
BIOINFORMATICS

Multiple Sequence Comparasion For Structural Interference

November 19, 2026

POPULAR NEWS

man in black shirt holding black smartphone

Watching TikTok and Instagram Reels Videos Deactivates the Brain’s Cognitive Control Network, Study Finds

by Shibasis Rath
August 20, 2026
1

Millions of people finish short video after short video every day; a new brain-scan study shows that the very act...

Dynamic Programming Approach to Edit Distance Calculation

Dynamic Programming Approach to Edit Distance Calculation

by Shibasis Rath
July 4, 2026
0

Edit distance between two strings is the minimum number of edit operations (insertion, deletion, replacement, match) required to transform one...

Scientists Have a Fascinating Hypothesis About Why Smart People Should Spend Less Time With Friends

Scientists Have a Fascinating Hypothesis About Why Smart People Should Spend Less Time With Friends

by Shibasis Rath
August 15, 2026
0

Higher intelligence links to lower life satisfaction when people socialize more often with friends. Researchers found this pattern in data...

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 - Updated on July 2, 2026
0

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

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 - Updated on March 14, 2026
0

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

EDITOR CHOICE‘S

  • All
  • NEWS
  • SPOTLIGHTS
Fruit Flies Without Heads Keep Cleaning Their Wings, Scientists Found the Cells Behind It

Fruit Flies Without Heads Keep Cleaning Their Wings, Scientists Found the Cells Behind It

by Shibasis Rath
November 30, 2026
0

Touch the wing of a fruit fly with no head, and its back legs still sweep the wing clean. That...

A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy

A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy

by Shibasis Rath
November 29, 2026
0

T cell engagers, lab-made antibodies that steer immune cells against rogue B cells, are drawing interest as a new lupus...

prostate-cancer

Targeted Radiation Therapy Slows Disease Progression in Advanced Prostate Cancer

by Shibasis Rath
November 27, 2026
0

A targeted radioactive therapy may give men with advanced prostate cancer more time before their disease worsens. In a phase...

Scientists Reveal How CRISPR Systems Recruit Enzymes for Precise DNA Insertion

Scientists Reveal How CRISPR Systems Recruit Enzymes for Precise DNA Insertion

by Gupteswar Acharya
November 26, 2026
0

Cryo-EM reveals how CRISPR-associated transposases recruit proteins and activate precise DNA insertion in bacteria. Researchers captured three structural stages of...

ADVERTISEMENT

Google News

Get RathBiotaClan stories in your Google News feed.

Add to Google News

RathBiotaClan – RBC

RathBiotaClan

Connecting Research to Reality.

Trusted life science news and biology research for students, researchers, and science enthusiasts.

About Us

Privacy Policies

Contact Us

Editorial Standard

Latest Posts

  • Fruit Flies Without Heads Keep Cleaning Their Wings, Scientists Found the Cells Behind It
  • A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy
  • Targeted Radiation Therapy Slows Disease Progression in Advanced Prostate Cancer
  • Scientists Reveal How CRISPR Systems Recruit Enzymes for Precise DNA Insertion

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 RathBiotaClan | Life Science & Biology Research
  • 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
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.

Discover more from RathBiotaClan

Subscribe now to keep reading and get access to the full archive.

Continue reading