16 private class HeapElement :
IMinHeapNode, IComparable<HeapElement> {
17 public int heapIndex {
get;
set; }
20 public HeapElement(
float value) {
24 public int CompareTo(HeapElement other) {
25 return value.CompareTo(other.value);
44 _heap.
Insert(
new HeapElement(0));
45 _heap.
Insert(
new HeapElement(2));
46 _heap.
Insert(
new HeapElement(1));
47 _heap.
Insert(
new HeapElement(-5));
48 _heap.
Insert(
new HeapElement(10));
50 Assert.That(_heap.
Validate(), Is.EqualTo(
true));
51 Assert.That(_heap.
PeekMin().value, Is.EqualTo(-5));
55 Assert.That(_heap.
Validate(), Is.EqualTo(
true));
56 Assert.That(_heap.
PeekMin().value, Is.EqualTo(0));
58 var element4 =
new HeapElement(4);
61 Assert.That(_heap.
Validate(), Is.EqualTo(
true));
65 Assert.That(_heap.
Validate(), Is.EqualTo(
true));
66 Assert.That(_heap.
Count, Is.EqualTo(4));