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
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
Step by Step Solution
3.39 Rating (149 Votes )
There are 3 Steps involved in it
ANSWER C public class BinTree public int data public BinTree lchild public BinTree rchild public Bin... View full answer
Get step-by-step solutions from verified subject matter experts
