Skip to content

Commit fdfbc4e

Browse files
committed
update the treap class for some errors regarding wrong usage of this keyword
1 parent 24b4088 commit fdfbc4e

File tree

1 file changed

+9
-9
lines changed
  • src/main/java/com/thealgorithms/datastructures/trees

1 file changed

+9
-9
lines changed

src/main/java/com/thealgorithms/datastructures/trees/Treap.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ static class TreapNode {
3232
private int priority, size;
3333
public TreapNode left, right;
3434

35-
public TreapNode(int value, int priority) {
36-
this.value = value;
37-
this.priority = priority;
38-
this.size = 1;
39-
this.left = this.right = null;
35+
public TreapNode(int _value, int _priority) {
36+
value = _value;
37+
priority = _priority;
38+
size = 1;
39+
left = right = null;
4040
}
4141

4242
/**
4343
* updateSize -> updates the subtree size of the current node
4444
*/
4545
private void updateSize() {
46-
this.size = 1;
47-
if (this.left != null) this.size += this.left.size;
48-
if (this.right != null) this.size += this.right.size;
46+
size = 1;
47+
if (left != null) size += left.size;
48+
if (right != null) size += right.size;
4949
}
5050
}
5151

@@ -63,7 +63,7 @@ private void updateSize() {
6363
* Treap(int[] nodeValues) -> add the elements given in the array to the Treap
6464
*/
6565
public Treap() {
66-
this.root = null;
66+
root = null;
6767
}
6868

6969
public Treap(int[] nodeValues) {

0 commit comments

Comments
 (0)