vendredi 17 octobre 2014

Java: Recursive tree function that shares a parameter?


Vote count:

0




If we're doing a print left view of a tree using a binary level print function, is there any way to pass around a shared parameter to all the recursive function calls?


For instance, in order to do print left view with a level order traversal, you check when the current level exceeds the max level encountered--this should be the first left node on the new level. Then all the other subsequent calls shouldn't have this issue. In C you have pointers so you can access the same address and change the max level seen, however, in java, what is the approach here



asked 23 secs ago







Java: Recursive tree function that shares a parameter?

Aucun commentaire:

Enregistrer un commentaire