On Fri, 4 Jul 2003 16:30:01 -0700 "Steven T. Hatton" <hattons@globalsymmetry.com> wrote:
I have to confess, without the ability to do some kind of recursion, I don't see where I would have much use for such a library. It looks as though there may be a solution. I am just now looking this over. This looks like a fantastic course:
http://www.cs.uiowa.edu/~rlawrenc/teaching/030/Notes/
My implementation did not have iterators, and I'm not sure how I would implement an iterator in a binary tree.
I guess one could do some kind of infix, prefix or postfix traversal, or simply iterate over the children. In the case of a binary tree, that doesn't make a lot of sense. In the case of an N-ary(sic) tree, that may make more sense. My implementation is fully recursive including both an preorder and inorder traversal. I just did not implement some of the generic algrithms and iterators. Generally, the STL contains most of the tools you need. While I don't have Rogue Wave, they have all sorts of good types, including binary trees.
The problem with the standard STL types is that they don't handle searches well, but a balanced binary tree handles insertions and searches very efficiently. (The down side is that if you do not have some kind of balancing algorithm, your tree could end up as a linked list). -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9