Skip to main content
Log in

What is dynamic programming?

  • Primer
  • Published:

From Nature Biotechnology

View current issue Submit your manuscript

Sequence alignment methods often use something called a 'dynamic programming' algorithm. What is dynamic programming and how does it work?

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Figure 1: The filled dynamic programming matrix for two DNA sequences, x = TTCATA and y = TGCTCGTA, for a scoring system of +5 for a match, −2 for a mismatch and −6 for each insertion or deletion.

Similar content being viewed by others

References

  1. Bellman, R.E. Eye of the Hurricane: An Autobiography (World Scientific, Singapore, 1984).

    Book  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Supplementary information

Supplementary Note

An example of global sequence alignment by dynamic programming. (C 7 kb)

The program is ANSI C and should compile on any machine that has a C compiler, with a command line like: gcc -o global global.c

To run the program: ./global

To change the sequences or the scoring system, you have to edit the appropriate #define's at the top of the program, and recompile. This is meant to be a simple working example of the mechanics of dynamic programming sequence alignment. The details of reading FASTA files and such are left as an exercise to the reader. Any questions about this program should be addressed directly to the author.

Further study

Further study

To study a working example, you can download a small, bare-bones C implementation of this algorithm (see Supplementary Note). I used this C program to generate Figure 1.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Eddy, S. What is dynamic programming?. Nat Biotechnol 22, 909–910 (2004). https://doi.org/10.1038/nbt0704-909

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1038/nbt0704-909

  • Springer Nature America, Inc.

This article is cited by

Navigation