top | item 34543779

(no title)

pyfan878 | 3 years ago

Sometimes, it's a way to elegantly solve some problems. Imagine you have a binary tree and you need to find it's depth. The answer is the maximum depth of its left and right subtree plus one. This easily translates into a recursive code.

It's true that it's rarely used in production quality code, but nonetheless it's sometimes useful and you should have a good command of writing recursive code.

discuss

order

No comments yet.