Algorithms and Pseudocode - PowerPoint PPT Presentation

About This Presentation
Title:

Algorithms and Pseudocode

Description:

Algorithms and Pseudocode. Bioinformatics. Formulating Problems. Clarify input ... Example: Given n cities and distances between cities, find the shortest tour ... – PowerPoint PPT presentation

Number of Views:70
Avg rating:3.0/5.0
Slides: 7
Provided by: johnpaul3
Category:

less

Transcript and Presenter's Notes

Title: Algorithms and Pseudocode


1
Algorithms and Pseudocode
  • Bioinformatics

2
Formulating Problems
  • Clarify input and output elements
  • Requires modeling the problem in some concise
    form
  • Example Given n cities and distances between
    cities, find the shortest tour
  • More concise description of input integer N,
    distances di,j, 1ltiltN, 1ltjltN. What about
    output?

3
Traveling Salesman Problem
  • Input Integer N Distances di,j, 1ltiltN,
    1ltjltN
  • Output Permutation p1 p2 pN of the integers
    1N such that ?1ltiltN dpi,pi1 is
    the smallest possible

4
String Search Problem
  • Input Strings s1m and t1n
  • Output The (smallest) position p such that for
    all i, 1 lt i lt m, si tpi-1 p 0,
    if no such p exists

5
Algorithm
  • String_Search(s1m, t1n)
  • for p 1 to n-m1 do
  • found true
  • for i 1 to m do
  • if si ? tpi-1 then
  • found false
  • if found then
  • break
  • if not found then
  • return 0
  • else
  • return p

6
Algorithm Specification
  • Pseudocode not tied to a particular programming
    language syntax
  • Data
  • Variables
  • Arrays
  • Statements
  • Assignments and computation
  • Decisions, conditions, and loops
  • Break and return
Write a Comment
User Comments (0)
About PowerShow.com