datastructures
Class Minheap

java.lang.Object
  extended by datastructures.Minheap

public class Minheap
extends java.lang.Object

This is a priority queue for Nodes implemented as min binary heap comparing f_values.


Constructor Summary
Minheap(int max)
           
 
Method Summary
 void insert(Node n)
          Inserts a node to heap.
 boolean is_empty()
          Return true if heap is empty.
 Node remove_middle(Node n)
          We search for node with same x and y value as given node.
 Node removemin()
          Removes and returns smallest node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Minheap

public Minheap(int max)
Method Detail

is_empty

public boolean is_empty()
Return true if heap is empty.


insert

public void insert(Node n)
Inserts a node to heap.

Parameters:
n - node to be inserted.

removemin

public Node removemin()
Removes and returns smallest node.

Returns:
Node with smallest f_value

remove_middle

public Node remove_middle(Node n)
We search for node with same x and y value as given node. Then we remove it from heap.

Parameters:
n - node to look for.
Returns:
removed node.