CGC_Codes

Not binary search tree

Jun 2nd, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace NotBinarySearchTree
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Node root = new Node(50);
  11.             Node c1 = new Node(100);
  12.             Node c2 = new Node(10);
  13.             Node c3 = new Node(-5);
  14.             Node c4 = new Node(0);
  15.             Node c5 = new Node(33);
  16.             Node c6 = new Node(1);
  17.             Node c7 = new Node(2);
  18.             Node c8 = new Node(3);
  19.             Node c9 = new Node(300);
  20.             Node c10 = new Node(350);
  21.  
  22.  
  23.             root.SetChild(c1);
  24.             root.SetChild(c2);
  25.             c2.SetChild(c3);
  26.             c3.SetChild(c4);
  27.             c3.SetChild(c5);
  28.             c3.SetChild(c6);
  29.             c3.SetChild(c7);
  30.             c3.SetChild(c8);
  31.  
  32.             c1.SetChild(c9);
  33.             c1.SetChild(c10);
  34.  
  35.             TreeNode teste = new TreeNode(root);
  36.             ICollection<Node> h1 = teste.FindChildrenForLevel(1);
  37.             TreeNode teste1 = new TreeNode(root);
  38.             ICollection<Node> h2 = teste1.FindChildrenForLevel(2);
  39.             TreeNode teste2 = new TreeNode(root);
  40.             ICollection<Node> h3 = teste2.FindChildrenForLevel(3);
  41.  
  42.             Console.ReadKey();
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment