Section categories |
Related Subjects
[38]
This category includes brief overview of all related subjects.
|
Defining BioInformatics
[7]
In this section we tried to briefly explain what bioinformatics is ?
|
Unviersities
[30]
This contains information about universities that are offering bioinformatics degree programs.
|
Resources
[24]
Contains information about bioinformatics resources including databases, tools and techniques.
|
Algorithms
[31]
This category includes some of the basic algorithms that are usually used by bioinformaticians.
|
|
Statistics |
Total online: 2 Guests: 2 Users: 0 |
|
Home » 2011 » August » 15 » Hirschberg's Algorithm Pseudocode
1:20 PM Hirschberg's Algorithm Pseudocode |
Hirschberg's Algorithm Pseudocode
1. Pseudocode: High-level description of the forwards subprogram
Forwards[x,y] is
1. n = length(x); m = length(y)
2. Edit[Prefix[0,0]] = 0;
3. For all i from 1 to n:
Edit[Prefix[x,i],Prefix[y,0]] = Edit[Prefix[x,i-1],Prefix[y,0]] + Del(x_i)
4. For all j from 1 to m:
A. Edit[Prefix[x,0],Prefix[y,j]] = Edit[Prefix[x,0],Prefix[y,j-1]] + Ins(y_j)
B. For all i from 1 to n, execute the following steps:
i. Edit[Prefix[x,i],Prefix[y,j]] =
min{Edit[Prefix[x,i-1],Prefix[y,j]] + Del(x_i),
Edit[Prefix[x,i-1],Prefix[y,j-1]] + Sub(x_i,y_j),
Edit[Prefix[x,i],Prefix[y,j-1]] + Ins(y_j)}
ii. Erase Edit[Prefix[x,i-1],Prefix[y,j-1]]
C. Erase Edit[Prefix[x,i-1],Prefix[y,j]]
5. RETURN Edit[x] %% an array of length m+1
High-level description of the backwards subprogram
Backwards[x,y] is
1. n = length(x); m = length(y)
2. For all i from 1 to n:
Edit[Suffix[x,i],Suffix[y,0]] = 0
3. For all j from 1 to m:
A. Edit[Suffix[x,0],Suffix[y,j]] = Edit[Suffix[x,n],Suffix[y,j-1]] + Ins(y_{m-j+1})
B. For all i from 1 to n:
i. Edit[Suffix[x,i],Suffix[y,j]] =
min{Edit[Suffix[x,i-1],Suffix[y,j]] + Del(x_{n-i-1}),
Edit[Suffix[x,i-1],Suffix[y,j-1]] + Sub(x_{n-i-1},y_{m-j+1}),
Edit[Suffix[x,i],Suffix[y,j-1]] + Ins(y_{m-j+1})}
ii. Erase Edit[Suffix[x,i-1],Suffix[y,j-1]]
C. Erase Edit[Suffix[x,i-1],Suffix[y,j]]
4. RETURN Edit[x] %% an array of length m+1
|
|
Category: Algorithms |
Views: 1635 |
Added by: Ansari
| Rating: 0.0/0 |
|
|
|