Added Heap Class with Create Methods
This commit is contained in:
parent
a37a81a2bf
commit
78ac09c4e9
27
C#/Datastructures/Heap/Heap.cs
Normal file
27
C#/Datastructures/Heap/Heap.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace C_.Datastructures.Heap
|
||||
{
|
||||
internal class Heap<T> where T:IComparable
|
||||
{
|
||||
internal HeapNode<T>? Root { get; set; }
|
||||
private int Count { get; set; }
|
||||
|
||||
public static Heap<T> Create(){
|
||||
return new Heap<T>{
|
||||
Root = null,
|
||||
Count = 0
|
||||
};
|
||||
}
|
||||
|
||||
public static Heap<T> Create(T value){
|
||||
return new Heap<T>{
|
||||
Root = HeapNode<T>.Create(value),
|
||||
Count = 1
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user