Skip to content

Commit 1196dcc

Browse files
author
Olcay Taner YILDIZ
committed
Updated second constructor of BTreeNode.
1 parent 3d0d6dd commit 1196dcc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/DataStructure/Tree/BTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void insert(T data){
4040
s = root.insertLeaf(data, comparator);
4141
if (s != null){
4242
BTreeNode<T> tmp = root;
43-
root = new BTreeNode<>(tmp, s, tmp.K[d], d);
43+
root = new BTreeNode<>(d, tmp, s, tmp.K[d]);
4444
tmp.K[d] = null;
4545
}
4646
} else {

src/main/java/DataStructure/Tree/BTreeNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public BTreeNode(int d){
1717
K = (T[]) new Object[2 * d + 1];
1818
children = new BTreeNode[2 * d + 1];
1919
}
20-
public BTreeNode(BTreeNode<T> firstChild, BTreeNode<T> secondChild, T newK, int d){
20+
public BTreeNode(int d, BTreeNode<T> firstChild, BTreeNode<T> secondChild, T newK){
2121
this(d);
2222
leaf = false;
2323
m = 1;
@@ -93,7 +93,7 @@ public BTreeNode<T> insertNode(T value, Comparator<T> comparator, boolean isRoot
9393
newNode.children[d] = s;
9494
m = d;
9595
if (isRoot){
96-
BTreeNode<T> a = new BTreeNode<T>(this, newNode, this.K[d], d);
96+
BTreeNode<T> a = new BTreeNode<T>(d, this, newNode, this.K[d]);
9797
this.K[d] = null;
9898
return a;
9999
} else {

0 commit comments

Comments
 (0)