forked from rbk-org/Java_DataStructures
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTree.java
More file actions
35 lines (26 loc) · 726 Bytes
/
Copy pathTree.java
File metadata and controls
35 lines (26 loc) · 726 Bytes
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
public class Tree {
Node root;
private class Node {
public int value;
public Tree[] children=new Tree[5];
public int counter=0;
}
public boolean addChild(int val) {
//your code is here
Tree child = new Tree();
child.root.value=val;
this.root.children[this.root.counter]=child;
this.root.counter++;
if(this.root.counter==this.root.children.size())
// this. = new Tree.Node[child.counter];
//
// child.value= val;
// child.children[child.counter-1]= child;
}
public boolean contains(int val) {
//your code is here
}
public void display() {
//your code is here
}
}