From 78ac09c4e9dd823dee6c279eebdc67fd9f4d53cc Mon Sep 17 00:00:00 2001 From: Luke Else Date: Sun, 4 Sep 2022 09:16:13 +0100 Subject: [PATCH] Added Heap Class with Create Methods --- C#/Datastructures/Heap/Heap.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 C#/Datastructures/Heap/Heap.cs diff --git a/C#/Datastructures/Heap/Heap.cs b/C#/Datastructures/Heap/Heap.cs new file mode 100644 index 0000000..9d6738d --- /dev/null +++ b/C#/Datastructures/Heap/Heap.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace C_.Datastructures.Heap +{ + internal class Heap where T:IComparable + { + internal HeapNode? Root { get; set; } + private int Count { get; set; } + + public static Heap Create(){ + return new Heap{ + Root = null, + Count = 0 + }; + } + + public static Heap Create(T value){ + return new Heap{ + Root = HeapNode.Create(value), + Count = 1 + }; + } + } +} \ No newline at end of file