Updated Program.cs to test HeapNode weighting

This commit is contained in:
Luke Else 2022-04-20 15:34:43 +01:00
parent e462929612
commit e66473bb25

View File

@ -1,5 +1,6 @@
using System; using System;
using C_.Datastructures.BinaryTree; using C_.Datastructures.BinaryTree;
using C_.Datastructures.Heap;
// See https://aka.ms/new-console-template for more information // See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!"); Console.WriteLine("Hello, World!");
@ -107,34 +108,43 @@ Console.WriteLine("Hello, World!");
//Tree<int> tree = new Tree<int>();
//tree.Add(40);
//tree.Add(30);
//tree.Add(50);
//tree.Add(25);
//tree.Add(35);
//tree.Add(45);
//tree.Add(60);
//tree.Add(15);
//tree.Add(28);
//tree.Add(55);
//tree.Add(70);
////var x = tree.Delete(10);
////tree.Delete(5);
//var inorder = tree.Traverse(TraversalType.Inorder);
//var preorder = tree.Traverse(TraversalType.Preorder);
//var postorder = tree.Traverse(TraversalType.Postorder);
//var breadthFirst = tree.Traverse(TraversalType.Breadth);
Tree<int> tree = new Tree<int>();
tree.Add(40);
tree.Add(30);
tree.Add(50);
tree.Add(25);
tree.Add(35);
tree.Add(45);
tree.Add(60);
tree.Add(15);
tree.Add(28);
tree.Add(55);
tree.Add(70);
//var x = tree.Delete(10);
//tree.Delete(5);
var inorder = tree.Traverse(TraversalType.Inorder);
var preorder = tree.Traverse(TraversalType.Preorder);
var postorder = tree.Traverse(TraversalType.Postorder);
var breadthFirst = tree.Traverse(TraversalType.Breadth);
var x = HeapNode<int>.Create(1, null, new HeapNode<int> { Left = default, Right = default });
Console.ReadLine(); Console.ReadLine();