-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPriorityQueueNode.java
More file actions
43 lines (39 loc) · 1.09 KB
/
PriorityQueueNode.java
File metadata and controls
43 lines (39 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class PriorityQueueNode extends HNode{
public PriorityQueueNode(HNode left, HNode right) {
super(left.count+right.count);
c = left.c+right.c;
this.left = left;
this.right = right;
left.parent = this;
right.parent = this;
}
public PriorityQueueNode(PriorityQueueNode left, HNode right) {
super(left.count+right.count);
c = left.c+right.c;
this.left = left;
this.right = right;
left.parent = this;
right.parent = this;
right.left = null;
right.right = null;
}
public PriorityQueueNode(HNode left, PriorityQueueNode right) {
super(left.count+right.count);
c = left.c+right.c;
this.left = left;
this.right = right;
left.parent = this;
right.parent = this;
left.left = null;
left.right = null;
}
public PriorityQueueNode(PriorityQueueNode nodeL,PriorityQueueNode nodeR){
super(nodeL.count+nodeR.count);
System.out.println("PQN constructor called for " +nodeL +" "+nodeR);
c = nodeL.c+nodeR.c;
this.left = nodeL;
this.right = nodeR;
nodeL.parent = this;
nodeR.parent = this;
}
}