Beispiel #1
0
 /// <summary>
 /// Recursive helper method for pre-order traversal. Should not be called directly
 /// </summary>
 /// <param name="current">The current node being traversed</param>
 /// <param name="list">The list of values to be added to</param>
 public void PreOrderTraversal(StringNode current, List <string> list)
 {
     //add current, then go to left, then to right
     list.Add(current.Value);
     if (current.Left != null)
     {
         PreOrderTraversal(current.Left, list);
     }
     if (current.Right != null)
     {
         PreOrderTraversal(current.Right, list);
     }
 }
Beispiel #2
0
 public void FizzBuzzRecursive(IntNode intNode, StringNode stringNode)
 {
     if (intNode.Left != null)
     {
         stringNode.Left = new StringNode(FizzBuzz(intNode.Left.Value));
         FizzBuzzRecursive(intNode.Left, stringNode.Left);
     }
     else if (intNode.Right != null)
     {
         stringNode.Right = new StringNode(FizzBuzz(intNode.Right.Value));
         FizzBuzzRecursive(intNode.Right, stringNode.Right);
     }
 }
Beispiel #3
0
 public StringNode(string val)
 {
     Value = val;
     Left  = null;
     Right = null;
 }
Beispiel #4
0
 public BinaryStringTree()
 {
     Root = null;
 }