Advertisement
vencinachev

TreeMain

Sep 8th, 2019
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             Tree<int> tree =
  6.                 new Tree<int>(7,
  7.                 new Tree<int>(19,
  8.                 new Tree<int>(1),
  9.                 new Tree<int>(12),
  10.                 new Tree<int>(31)),
  11.                 new Tree<int>(21),
  12.                 new Tree<int>(14,
  13.                 new Tree<int>(23),
  14.                 new Tree<int>(6))
  15.                 );
  16.             Console.WriteLine("Breadth-First Search (BFS)");
  17.             tree.PrintBFS();
  18.             Console.WriteLine("\n\nDepth-First Search (DFS)");
  19.             tree.PrintDFS();
  20.             Console.WriteLine();
  21.         }
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement