This is a typical problem of recursion.
The diameter of a tree is the number of nodes on the longest path between two leaves in the tree. So you can compute it as the max among the height for the left subtree, the height of the right subtree and the longest path between two leaves passing through the root.
Google H840, un successore per Nexus Q?
-
Compare sul sito della FCC un nuovo media player targato Google: potrebbe
trattarsi del successore per il Nexus Q presentato e abbandonato lo scorso
anno.
17 minutes ago
http://tech-queries.blogspot.com/2010/09/diameter-of-tree-in-on.html
ReplyDelete