Write the equivalent of Figure 6.5 in C# or Ruby. Write a second version that performs an

Question:

Write the equivalent of Figure 6.5 in C# or Ruby. Write a second version that performs an in-order enumeration, rather than preorder.

Figure 6.5:

class BinTree: def -_init_ (self): # constructor self.data = self.lchild self.rchild = None # other methods: insert, delete, lookup, def preorder (self): if self.data != None: yield self.data if self.lchild != None: for d in self.1child.preorder(): yield d if self.rchild != None: for d in self.rchild.preorder (): yield d

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: