Download presentation
Presentation is loading. Please wait.
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 d[i,j], 1<=i<=N, 1<=j<=N. What about output?
3
Traveling Salesman Problem Input:Integer N Distances d[i,j], 1<=i<=N, 1<=j<=N Output:Permutation p 1 p 2 … p N of the integers 1…N such that 1<=i<N d[p i,p i+1 ] is the smallest possible
4
String Search Problem Input:Strings s[1…m] and t[1…n] Output:The (smallest) position p such that for all i, 1 <= i <= m, s[i] = t[p+i-1]; p = 0, if no such p exists
5
Algorithm String_Search(s[1…m], t[1…n]) for p = 1 to n-m+1 do found = true for i = 1 to m do if s[i] t[p+i-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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.