[Tutor] One other thing·...
VanL
van@lindbergs.org
Fri, 11 May 2001 18:53:24 -0600
One of the other things I was considering was extending this tree class
to implement different types of trees.
(Start imaginary python session)
>>> from Tree import BinaryTree, AVLTree
>>> a1 = AVLTree('data1')
>>> a2 = AVLTree('data2')
>>> b1 = BinaryTree('root')
>>> b2 = BinaryTree('left')
>>> a1.treetype()
'AVL'
>>> b1.treetype()
'binary'
>>> a1 = a1 + a2
>>> b
That last operation would test that the two types were compatible, and,
where applicable, perform the tree merge. All this stuff would be hard
to do, if not impossible, if I can't figure out what I've got when I am
passed in an object.
Van