style: enable MethodName in CheckStyle (#5182)

enabled: MethodName in CheckStyle
This commit is contained in:
Godwill Christopher
2024-05-27 01:06:06 -06:00
committed by GitHub
parent ea4dc15a24
commit 295e7436b1
53 changed files with 225 additions and 225 deletions

View File

@ -91,7 +91,7 @@ public class LeftistHeap {
}
// Returns and removes the minimum element in the heap
public int extract_min() {
public int extractMin() {
// If is empty return -1
if (isEmpty()) return -1;
@ -101,17 +101,17 @@ public class LeftistHeap {
}
// Function returning a list of an in order traversal of the data structure
public ArrayList<Integer> in_order() {
public ArrayList<Integer> inOrder() {
ArrayList<Integer> lst = new ArrayList<>();
in_order_aux(root, lst);
inOrderAux(root, lst);
return new ArrayList<>(lst);
}
// Auxiliary function for in_order
private void in_order_aux(Node n, ArrayList<Integer> lst) {
private void inOrderAux(Node n, ArrayList<Integer> lst) {
if (n == null) return;
in_order_aux(n.left, lst);
inOrderAux(n.left, lst);
lst.add(n.element);
in_order_aux(n.right, lst);
inOrderAux(n.right, lst);
}
}

View File

@ -25,10 +25,10 @@ public class GenericTree {
private final Node root;
public GenericTree() { // Constructor
Scanner scn = new Scanner(System.in);
root = create_treeG(null, 0, scn);
root = createTreeG(null, 0, scn);
}
private Node create_treeG(Node node, int childIndex, Scanner scanner) {
private Node createTreeG(Node node, int childIndex, Scanner scanner) {
// display
if (node == null) {
System.out.println("Enter root's data");
@ -41,7 +41,7 @@ public class GenericTree {
System.out.println("number of children");
int number = scanner.nextInt();
for (int i = 0; i < number; i++) {
Node child = create_treeG(node, i, scanner);
Node child = createTreeG(node, i, scanner);
node.child.add(child);
}
return node;
@ -51,17 +51,17 @@ public class GenericTree {
* Function to display the generic tree
*/
public void display() { // Helper function
display_1(root);
display1(root);
}
private void display_1(Node parent) {
private void display1(Node parent) {
System.out.print(parent.data + "=>");
for (int i = 0; i < parent.child.size(); i++) {
System.out.print(parent.child.get(i).data + " ");
}
System.out.println(".");
for (int i = 0; i < parent.child.size(); i++) {
display_1(parent.child.get(i));
display1(parent.child.get(i));
}
}

View File

@ -8,7 +8,7 @@ final class NearestRightKey {
}
public static void main(String[] args) {
NRKTree root = BuildTree();
NRKTree root = buildTree();
Scanner sc = new Scanner(System.in);
System.out.print("Enter first number: ");
int inputX0 = sc.nextInt();
@ -17,7 +17,7 @@ final class NearestRightKey {
sc.close();
}
public static NRKTree BuildTree() {
public static NRKTree buildTree() {
int randomX = ThreadLocalRandom.current().nextInt(0, 100 + 1);
NRKTree root = new NRKTree(null, null, randomX);