Example #1
0
 private int Size(FCNSNode <T> node)  // Size: Aantal nodes in de tree
 {
     if (node == null)
     {
         return(0); // Return 0 als een node niet bestaat.
     }
     else
     {
         return(1 + Size(node.child) + Size(node.sibling)); // Return 1 als een node wél bestaat, en check of er children zijn
     }
 }
Example #2
0
 private void PrintPreOrder(FCNSNode <T> node) // Pre-order: Self, Links, Rechts
 {
     if (node == null)                         // If the node is null, we stop here
     {
         return;
     }
     else                                 // Else, we print the value and do PrintPreOrder for the child and sibling, if they are null, they get caught in their function
     {
         Console.Write(node.value + " "); // self..
         PrintPreOrder(node.child);       // linker child is altijd de child v/d FCNS
         PrintPreOrder(node.sibling);     // rechter child is altijd de sibling v/d FCNS
     }
 }
Example #3
0
        public FCNSNode <T> sibling;                                       // This is the sibling

        public FCNSNode(T value, FCNSNode <T> child, FCNSNode <T> sibling) // Basic constructor
        {
            this.value   = value;
            this.child   = child;
            this.sibling = sibling;
        }
Example #4
0
 public FCNSTree(FCNSNode <T> root)
 {
     this.root = root;
 }