@@ -8,22 +8,22 @@ namespace Advanced.Algorithms.DataStructures
88 /// <summary>
99 /// A fibornacci minMax heap implementation.
1010 /// </summary>
11- public class FibornacciHeap < T > : IEnumerable < T > where T : IComparable
11+ public class FibonacciHeap < T > : IEnumerable < T > where T : IComparable
1212 {
1313 private readonly bool isMaxHeap ;
1414 private readonly IComparer < T > comparer ;
1515
1616 //holds the min/max node at any given time
17- private FibornacciHeapNode < T > minMaxNode = null ;
17+ private FibonacciHeapNode < T > minMaxNode = null ;
1818
19- private FibornacciHeapNode < T > heapForestHead ;
19+ private FibonacciHeapNode < T > heapForestHead ;
2020
21- private Dictionary < T , List < FibornacciHeapNode < T > > > heapMapping
22- = new Dictionary < T , List < FibornacciHeapNode < T > > > ( ) ;
21+ private Dictionary < T , List < FibonacciHeapNode < T > > > heapMapping
22+ = new Dictionary < T , List < FibonacciHeapNode < T > > > ( ) ;
2323
2424 public int Count { get ; private set ; }
2525
26- public FibornacciHeap ( SortDirection sortDirection = SortDirection . Ascending )
26+ public FibonacciHeap ( SortDirection sortDirection = SortDirection . Ascending )
2727 {
2828 this . isMaxHeap = sortDirection == SortDirection . Descending ;
2929 comparer = new CustomComparer < T > ( sortDirection , Comparer < T > . Default ) ;
@@ -34,7 +34,7 @@ public FibornacciHeap(SortDirection sortDirection = SortDirection.Ascending)
3434 /// </summary>
3535 public void Insert ( T newItem )
3636 {
37- var newNode = new FibornacciHeapNode < T > ( newItem ) ;
37+ var newNode = new FibonacciHeapNode < T > ( newItem ) ;
3838
3939 //return pointer to new Node
4040 mergeForests ( newNode ) ;
@@ -145,10 +145,10 @@ public void UpdateKey(T currentValue, T newValue)
145145 /// Unions this heap with another.
146146 /// Time complexity: O(1).
147147 /// </summary>
148- public void Merge ( FibornacciHeap < T > FibornacciHeap )
148+ public void Merge ( FibonacciHeap < T > FibonacciHeap )
149149 {
150- mergeForests ( FibornacciHeap . heapForestHead ) ;
151- Count = Count + FibornacciHeap . Count ;
150+ mergeForests ( FibonacciHeap . heapForestHead ) ;
151+ Count = Count + FibonacciHeap . Count ;
152152 }
153153
154154 /// <summary>
@@ -177,7 +177,7 @@ private void Meld()
177177 }
178178
179179 //degree - node dictionary
180- var mergeDictionary = new Dictionary < int , FibornacciHeapNode < T > > ( ) ;
180+ var mergeDictionary = new Dictionary < int , FibonacciHeapNode < T > > ( ) ;
181181
182182 var current = heapForestHead ;
183183 minMaxNode = current ;
@@ -270,7 +270,7 @@ private void Meld()
270270 /// <summary>
271271 /// Delete this node from Heap Tree and adds it to forest as a new tree
272272 /// </summary>
273- private void cut ( FibornacciHeapNode < T > node )
273+ private void cut ( FibonacciHeapNode < T > node )
274274 {
275275 var parent = node . Parent ;
276276
@@ -301,7 +301,7 @@ private void cut(FibornacciHeapNode<T> node)
301301 /// <summary>
302302 /// Merges the given fibornacci node list to current Forest
303303 /// </summary>
304- private void mergeForests ( FibornacciHeapNode < T > headPointer )
304+ private void mergeForests ( FibonacciHeapNode < T > headPointer )
305305 {
306306 var current = headPointer ;
307307 while ( current != null )
@@ -313,7 +313,7 @@ private void mergeForests(FibornacciHeapNode<T> headPointer)
313313
314314 }
315315
316- private void insertNode ( ref FibornacciHeapNode < T > head , FibornacciHeapNode < T > newNode )
316+ private void insertNode ( ref FibonacciHeapNode < T > head , FibonacciHeapNode < T > newNode )
317317 {
318318 newNode . Next = newNode . Previous = null ;
319319
@@ -329,7 +329,7 @@ private void insertNode(ref FibornacciHeapNode<T> head, FibornacciHeapNode<T> ne
329329 head = newNode ;
330330 }
331331
332- private void deleteNode ( ref FibornacciHeapNode < T > heapForestHead , FibornacciHeapNode < T > deletionNode )
332+ private void deleteNode ( ref FibonacciHeapNode < T > heapForestHead , FibonacciHeapNode < T > deletionNode )
333333 {
334334 if ( deletionNode == heapForestHead )
335335 {
@@ -355,26 +355,26 @@ private void deleteNode(ref FibornacciHeapNode<T> heapForestHead, FibornacciHeap
355355 deletionNode . Previous = null ;
356356 }
357357
358- private void addMapping ( T newItem , FibornacciHeapNode < T > newNode )
358+ private void addMapping ( T newItem , FibonacciHeapNode < T > newNode )
359359 {
360360 if ( heapMapping . ContainsKey ( newItem ) )
361361 {
362362 heapMapping [ newItem ] . Add ( newNode ) ;
363363 }
364364 else
365365 {
366- heapMapping [ newItem ] = new List < FibornacciHeapNode < T > > ( new [ ] { newNode } ) ;
366+ heapMapping [ newItem ] = new List < FibonacciHeapNode < T > > ( new [ ] { newNode } ) ;
367367 }
368368 }
369369
370- private void updateNodeValue ( T currentValue , T newValue , FibornacciHeapNode < T > node )
370+ private void updateNodeValue ( T currentValue , T newValue , FibonacciHeapNode < T > node )
371371 {
372372 removeMapping ( currentValue , node ) ;
373373 node . Value = newValue ;
374374 addMapping ( newValue , node ) ;
375375 }
376376
377- private void removeMapping ( T currentValue , FibornacciHeapNode < T > node )
377+ private void removeMapping ( T currentValue , FibonacciHeapNode < T > node )
378378 {
379379 heapMapping [ currentValue ] . Remove ( node ) ;
380380 if ( heapMapping [ currentValue ] . Count == 0 )
0 commit comments