once again I'm asking help ( not to provide me with code example or pseudo code ), but for clarification on the problem.
It seems that this double loop ( iterative approach )
for (int y2 = y; y2 >= 0; y2--)
{
for (int x2 = x; x2 >= 0; x2--)
{
cost[y2][x2] = eval(y2, x2);
}
}
- Y being the length of the smaller string ( "TAAGGTCA" )
- X being the length of the larger string ( "AAGAGTTACC" )
- cost being the two dimentional array for the grid structure.
- eval being the function that just compares the neighbouring cell values and returns the smallest one ( few if statements, that's it )
leads to the same result performance wise as the recursive one: ( Y * X ) or ( M * N ) as from the slides.
Recovering the best alignment:
...
Total running time: O(mn)!
( **Lecture slide: 34/36 )**
So my questions are:
- Why it seems that the recursive approach here is unnecessary performance and code wise?
- I would like any help( except pseudo code/code examples) of how to develop the recursive approach.It seems like a rod cutting example, but in a way it's different by a lot, because you can have two different length strings.