Recursive Traversal Method: PrintBeneathNode 

The goal for this exercise is to implement the binary search tree’s PrintBeneathNode method, in C# source code.


            This exercise is intended as more of an open-ended, challenging exercise.  You will need to go beyond what has been covered in the book/lecture, and apply what you’ve learned previously to do this exercise.

 What you need to do for this exercise: 

  1. In the provided starter solution, there is a project named PCE_Starter, there is a class named BinarySearchTreeFor this exercise, you should implement the ‘PrintBeneathNode’ method.  Feel free to do this using recursion, using iteration, or using a combination of the two.
  2. Calling PrintBeneathNode( X ) will first find the node with the value X, and if it finds it, it will print (in normal, ascending order) all the values at (or beneath) that node. If it doesn’t fit a node with the value X then it will print nothing.

    Let’s say that you have the following tree:

    Let’s examine a couple of examples:
    1. PrintBeneathNode(  1 ) should print “1, 2”
    2. PrintBeneathNode(  5 ) should print “1, 2, 5, 7”
    3. PrintBeneathNode(  7 ) should print “7”
    4. PrintBeneathNode(  12 ) should print “12”
    5. PrintBeneathNode(  15 ) should print nothing
  3. You should make sure to add in some tests (perhaps in Main, perhaps in a separate, stand-alone class for testing) that will call your method a couple of different times.