Skip to content
Permalink
Browse files
more inline comments on cut() and cascadingCut() methods
  • Loading branch information
simonetripodi committed Jun 28, 2012
1 parent e96f3fd commit 75bbdafdc8bfa1f1cf8530382d3e982c83a234c5
Showing 1 changed file with 17 additions and 0 deletions.
@@ -474,6 +474,12 @@ private void link( FibonacciHeapNode<E> y, FibonacciHeapNode<E> x )
/**
* Implements the {@code CUT(H,x,y)} function.
*
* <pre>CUT(H,x,y)
* 1 remove x from the child list of y, decrementing degree[y]
* 2 add x to the root list of H
* 3 p[x] &lt;- NIL
* 4 mark[x] &lt;- FALSE</pre>
*
* @param x the node has to be removed from {@code y} children
* @param y the node has to be updated
*/
@@ -484,6 +490,9 @@ private void cut( FibonacciHeapNode<E> x, FibonacciHeapNode<E> y )
x.getRight().setLeft( x.getLeft() );
y.decraeseDegree();

// add x to the root list of H
// TODO!!!

// p[x] <- NIL
x.setParent( null );

@@ -494,6 +503,14 @@ private void cut( FibonacciHeapNode<E> x, FibonacciHeapNode<E> y )
/**
* Implements the {@code CASCADING-CUT(H,y)} function.
*
* <pre>CASCADING-CUT(H,y)
* 1 z p[y]
* 2 if z NIL
* 3 then if mark[y] = FALSE
* 4 then mark[y] TRUE
* 5 else CUT(H,y,z)
* 6 CASCADING-CUT(H,z)</pre>
*
* @param y the target node to apply CASCADING-CUT
*/
private void cascadingCut( FibonacciHeapNode<E> y )

0 comments on commit 75bbdaf

Please sign in to comment.