mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-29 23:42:34 +08:00
Code cleanup (#4246)
This commit is contained in:
@ -23,8 +23,6 @@ public class GenericTree {
|
||||
}
|
||||
|
||||
private Node root;
|
||||
private int size;
|
||||
|
||||
public GenericTree() { // Constructor
|
||||
Scanner scn = new Scanner(System.in);
|
||||
root = create_treeG(null, 0, scn);
|
||||
@ -44,7 +42,6 @@ public class GenericTree {
|
||||
int number = scn.nextInt();
|
||||
for (int i = 0; i < number; i++) {
|
||||
Node child = create_treeG(node, i, scn);
|
||||
size++;
|
||||
node.child.add(child);
|
||||
}
|
||||
return node;
|
||||
|
@ -30,11 +30,6 @@ public class TreeRandomNode {
|
||||
|
||||
int item;
|
||||
Node left, right;
|
||||
|
||||
public Node(int key) {
|
||||
item = key;
|
||||
left = right = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Using an arraylist to store the inorder traversal of the given binary tree
|
||||
|
@ -12,6 +12,7 @@ class Main {
|
||||
int inputX0 = sc.nextInt();
|
||||
int toPrint = nearestRightKey(root, inputX0);
|
||||
System.out.println("Key: " + toPrint);
|
||||
sc.close();
|
||||
}
|
||||
|
||||
public static NRKTree BuildTree() {
|
||||
|
Reference in New Issue
Block a user