1,105,399 Community Members

Finding level statistics for a BST

Member Avatar
Newbie Poster
5 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]

I'm working in the confines of a binary search tree and an AVL tree, doing some operations to find different statistics for these trees when given large random values. For instance some of my functions include finding the average leaf node depth, find the shallowest leaf node, etc.

My question is what is the best way to go through these trees and calculate such values, noting which level things are found, etc. I was considering a level order traversal but I'm not sure the implementation.

Any hints or advice will help, Thanks!

Edit: Any tips about keeping a height variable with that would be helpful too.

Member Avatar
Junior Poster
148 posts since Oct 2011
Reputation Points: -1 [?]
Q&As Helped to Solve: 27 [?]
Skill Endorsements: 0 [?]

can you elaborate what you want exactly!! with some code effort

This article has been dead for over three months: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: