return printLCS(i-1, j-1) + index(x, i);
i found this in a recursive java program, well that is being done is return index(x, i) (returns a character) and same time continue recursion?
return printLCS(i-1, j-1) + index(x, i);
i found this in a recursive java program, well that is being done is return index(x, i) (returns a character) and same time continue recursion?
no idea, so this formula (if i removed "return printLCS") is valid for MsExcel
index() & printLCS in a java custom functions, printLCS makes recursion, well, may call recursion like this and same time output to screen, all in one line? yes you can / no you can not
script worked from book
With that limited info provided by you, nobody can be wise...
I mean call two functions with "+", one proceed the recursion, the other output string to screen?
What is happening there first both methods are executed and then results are either added if numeric value (5+3 = 8), or index(x, i)
is appended to printLCS(i-1, j-1)
(south + west = southwest)
Yes but one function is recursive call itself: eg
public printLCS(i-1, j-1) {
.....
.....
printLCS(i, j)
.....
.....
}
the other[index(x, i)] returns directly a string
That doesn't matter printLCS must have some return type and this added up with the return from other method. As I said in first post, without proper code snippets nobody can be wiser...
the
else {
return printLCS(i-1, j-1) + index(x, i);
}
is equivalent to
else {
printLCS(i-1, j-1);
return index(x, i);
}
@Ise123: they are only equivalent if printLCS(i-1, j-1) returns zero. Which seems unlikely...
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.