Documentation Project 1
ContentsIndexHome
PreviousUpNext
sack::containers::BinaryTree::BalanceBinaryTree Function
C++
__cdecl TYPELIB_PROC void BalanceBinaryTree(PTREEROOT root);

Balances a binary tree. If data is added to a binary list in a linear way (from least to most), the tree can become unbalanced, and all be on the left or right side of data. This routine can analyze branches and perform rotations so that the tree can be discretely rebalanced.

PTREEROOT tree;
   
/* AddBinaryNode... */
BalanceBinaryTree( tree );
Copyright (c) 2010. All rights reserved.
What do you think about this topic? Send feedback!