Skip to content

Commit abac39f

Browse files
committed
S40
1 parent 36f576f commit abac39f

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

bT/src/main/java/com/mycompany/bt/BTree.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,21 @@ Node search(int number){
2727
if(root.searchKeys(0, root.keys.size() - 1, number) == true){
2828
System.out.println("found the node");
2929
System.out.println("root.leaf = " + root.leaf);
30-
System.out.println("the currsent node is the node with keys ");
30+
System.out.println("the resulted node is the node with keys ");
3131
for(Integer key : root.keys){
3232
System.out.print(key + " ");
3333
}
34-
System.out.println("");
35-
System.out.println("currentnode == null is " + (root == null));
36-
System.out.println("returning root ");
37-
for(Integer key : root.keys){
38-
System.out.print(key + " ");
39-
}
40-
System.out.println("");
41-
return this.root;
34+
return root;
4235
}
4336

4437
if(root.children.size() > 0){
4538
System.out.println("searching the leaves");
4639
for(Node node : root.children){
4740
BTree bt = new BTree(node);
48-
bt.search(number);
41+
Node node1 = bt.search(number);
42+
if(node != null){
43+
return node1;
44+
}
4945
}
5046
}
5147
return null;
@@ -77,8 +73,6 @@ public static void main(String[] args) {
7773
}
7874
System.out.println("----------------------------------------");
7975
Node answer1 = bt.search(7);
80-
System.out.println("hi 7!!!!!!!");
81-
System.out.println("answer1 == null is " + (bt.search(7) == null));
8276
if(answer1 == null){
8377
System.out.println("answer is null.");
8478
}else {

0 commit comments

Comments
 (0)