Hello again.I recently have been doing a assignment which asks us to write a function to check whether a tree is perfectly balanced.I know the concept of Perfectly balanced tree but I just cant make out how to write this function.Any help in right direction will be highly welcome.
ariel930 11 Newbie Poster
Recommended Answers
Jump to PostBy perfectly balanced do you mean a complete tree? A full tree? Merely a height balanced or weight balanced tree? The algorithm is different for each. Typically what's meant is height balance, or what would be the desired end structure maintained an AVL tree.
A recursive algorithm presents itself immediately …
Jump to PostAlso note that you might be able to skip transversal if the number of nodes isn't a power of 2. If it is, then you have to transverse just to make sure it fits the definition.
All 7 Replies
ken_taiken 0 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
ariel930 11 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
ariel930 11 Newbie Poster
deceptikon commented: Grats! +11
mrnutty 761 Senior Poster
yde 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.