style: enable MultipleVariableDeclarations in checkstyle (#5175)

Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com>
This commit is contained in:
vaibhav9t1
2024-05-25 23:48:27 +05:30
committed by GitHub
parent 44ce6e7b0d
commit 9eaa2bb756
82 changed files with 299 additions and 121 deletions

View File

@@ -9,7 +9,9 @@ public class AVLTree {
private int key;
private int balance;
private int height;
private Node left, right, parent;
private Node left;
private Node right;
private Node parent;
Node(int k, Node p) {
key = k;

View File

@@ -14,14 +14,16 @@ public final class LCA {
ArrayList<ArrayList<Integer>> adj = new ArrayList<>();
// v is the number of vertices and e is the number of edges
int v = SCANNER.nextInt(), e = v - 1;
int v = SCANNER.nextInt();
int e = v - 1;
for (int i = 0; i < v; i++) {
adj.add(new ArrayList<Integer>());
}
// Storing the given tree as an adjacency list
int to, from;
int to;
int from;
for (int i = 0; i < e; i++) {
to = SCANNER.nextInt();
from = SCANNER.nextInt();
@@ -40,7 +42,8 @@ public final class LCA {
dfs(adj, 0, -1, parent, depth);
// Inputting the two vertices whose LCA is to be calculated
int v1 = SCANNER.nextInt(), v2 = SCANNER.nextInt();
int v1 = SCANNER.nextInt();
int v2 = SCANNER.nextInt();
// Outputting the LCA
System.out.println(getLCA(v1, v2, depth, parent));

View File

@@ -10,10 +10,12 @@ public class LazySegmentTree {
*/
static class Node {
private final int start, end; // start and end of the segment represented by this node
private final int start;
private final int end; // start and end of the segment represented by this node
private int value; // value is the sum of all elements in the range [start, end)
private int lazy; // lazied value that should be added to children nodes
Node left, right; // left and right children
Node left;
Node right; // left and right children
Node(int start, int end, int value) {
this.start = start;

View File

@@ -10,7 +10,8 @@ class TreeNode {
// Members
int key;
TreeNode left, right;
TreeNode left;
TreeNode right;
// Constructor
TreeNode(int key) {

View File

@@ -12,8 +12,11 @@ public class RedBlackBST {
private class Node {
int key = -1, color = B;
Node left = nil, right = nil, p = nil;
int key = -1;
int color = B;
Node left = nil;
Node right = nil;
Node p = nil;
Node(int key) {
this.key = key;

View File

@@ -29,7 +29,8 @@ public class TreeRandomNode {
private final class Node {
int item;
Node left, right;
Node left;
Node right;
}
// Using an arraylist to store the inorder traversal of the given binary tree

View File

@@ -47,7 +47,8 @@ public final class VerticalOrderTraversal {
/* min and max stores leftmost and right most index to
later print the tree in vertical fashion.*/
int max = 0, min = 0;
int max = 0;
int min = 0;
queue.offer(root);
index.offer(0);