-
-
Notifications
You must be signed in to change notification settings - Fork 359
/
Copy pathProgram.cs
29 lines (27 loc) · 1.02 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// submitted by Julian Schacher (jspp)
using System;
namespace TreeTraversal
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("TreeTraversal");
var tree = new Tree(3, 3);
Console.WriteLine("DFSRecursive:");
tree.DFSRecursive();
Console.WriteLine("DFSStack:");
tree.DFSStack();
Console.WriteLine("BFSQueue:");
tree.BFSQueue();
Console.WriteLine("DFSRecursivePostorder");
tree.DFSRecursivePostorder();
// Uncommenting the following 2 lines will result in an exception thrown because at least one Node of the Tree has more than 2 children and therefor a DFSRecursiveInorderBinary doesn't work.
// Console.WriteLine("DFSRecursiveInorder (fail)");
// tree.DFSRecursiveInorderBinary();
tree = new Tree(3, 2);
Console.WriteLine("DFSRecursiveInorder (succeed)");
tree.DFSRecursiveInorderBinary();
}
}
}