Skip to content
Snippets Groups Projects
Commit 433883ea authored by tanguy.dietrich's avatar tanguy.dietrich
Browse files

Ecriture de quelque fonction basique

parent cdd0ae83
No related branches found
No related tags found
2 merge requests!2Tanguy,!1David
......@@ -5,9 +5,55 @@ import java.util.ArrayList;
import java.util.function.DoubleFunction;
import java.util.function.Function;
final public class BinaryHeap {
final public class BinaryHeap
{
final private List<Integer> lstBinaryHeap;
private BinaryHeap()
{
lstBinaryHeap=new ArrayList<Integer>();
}
public void push(int value)
{
}
private int getRightNodeIndex(int index)
{
return (2*index)+1;
}
private int getLeftNodeIndex(int index)
{
return (2*index)+2;
}
private BinaryHeap() {
private int getParentNodeIndex(int index)
{
return (index-1) / 2;
}
private int getRightNodeValue(int index)
{
return this.get(this.getRightNodeIndex(index));
}
private int getLeftNodeValue(int index)
{
return this.get(this.getLeftNodeIndex(index));
}
private int getParentNodeValue(int index)
{
return this.get(this.getParentNodeIndex(index));
}
private int get(int index)
{
return this.lstBinaryHeap.get(index);
}
private void set(int index, int val)
{
this.lstBinaryHeap.set(index,val);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment