Fibonacci heap: Difference between revisions

Content deleted Content added
Wherrera (talk | contribs)
Wherrera (talk | contribs)
Line 845: Line 845:
node.right.left = node.left
node.right.left = node.left
end
end

function delete!(root, node)
function delete!(root, node)
if (parent = node.parent) == nothing
if (parent = node.parent) == nothing
Line 854: Line 854:
else
else
remove_from_child_list(root, parent, node)
remove_from_child_list(root, parent, node)
end
if root.rootlist != nothing
root.nodecount -= 1
root.minnode = root.rootlist
for n in aslist(root.rootlist)
if n != nothing && n.value < root.minnode.value
root.minnode = n
end
end
end
end
end
end
Line 884: Line 893:
Delete(h3, xkeys[3])
Delete(h3, xkeys[3])
print(h3)
print(h3)
println("The minimum of h3 is now: ", Minimum(h3).value
</lang>{{out}}
</lang>{{out}}
<pre>
<pre>
Line 919: Line 929:
│ └─╴time
│ └─╴time
└─╴now
└─╴now
The minimum of h3 is now: good
</pre>
</pre>