3 ms·
Hip(n) { If n == 0 Return Log(“std rec ex ” + n) n -= 1 Hip(n) } On phone (so untested pseudo code), but this is my standard way of thinking about it.
by mettamage 6y ago
Hip(n) {
If n == 0
Return
Log(“std rec ex ” + n)
n -= 1
Hip(n)
}
On phone (so untested pseudo code), but this is my standard way of thinking about it. I think implementing bfs and dfs also helps to get it a bit more.
And I have needed to do recursion on web dev, because it’s the easiest way to deal with trees on your own.