Re: finding height of a BST by iteration
- From: Ben Pfaff <blp@xxxxxxxxxxxxxxx>
- Date: Tue, 27 Mar 2007 23:22:55 -0700
"subramanian100in@xxxxxxxxx, India" <subramanian100in@xxxxxxxxx>
writes:
I know the Inorder, Preorder and Postorder traversal of a BST by
iteration.
Still I do not know how to calculate the height of a BST by iteration.
Traverse the BST. Each time you move downward, increment a
counter; if the counter is greater than the maximum known height,
then set the maximum known height to the counter. Each time you
move upward, decrement the counter. When traversal is finished,
the maximum known height is the height.
--
Ben Pfaff
http://benpfaff.org
.
- References:
- finding height of a BST by iteration
- From: subramanian100in@xxxxxxxxx, India
- finding height of a BST by iteration
- Prev by Date: Re: finding height of a BST by iteration
- Next by Date: Re: finding height of a BST by iteration
- Previous by thread: Re: finding height of a BST by iteration
- Next by thread: Re: finding height of a BST by iteration
- Index(es):
Relevant Pages
|