Skip to content

Commit

Permalink
Merge pull request #1 from BackofenLab/ex1_traceback
Browse files Browse the repository at this point in the history
Update exercise-sheet-1.Rmd
  • Loading branch information
RickGelhausen authored Jan 10, 2024
2 parents 6a70eb5 + a6aba38 commit d3531bc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions exercise-sheet-1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,17 @@ There could be more than one optimal traceback for one optimal solution if the r
Pseudo Code Traceback

```{r, eval=FALSE,}
Procedure trackback(i,j)
Procedure traceback(i,j)
if (j <= i)
return
else if N_{i,j} = N_{i,j-1} then
trackback(i,j-1);
else if N_{i,j} = N_{i+1,j-1} +1, S_{i} and S_{j} complementary then
print(i,j)
traceback(i+1,j-1);
return
else
for all k: i <= k < j, S_{k} and S_{j} complementary do
if N_{i,j} = N_{i,k-1} + N_{k+1,j-1} + 1 then
print(k,j)
for all k: i <= k < j do
if N_{i,j} = N_{i,k} + N_{k+1,j} then
traceback(i,k); traceback(k+1,j)
return
end if
end for
Expand Down

0 comments on commit d3531bc

Please sign in to comment.