style: enable LocalVariableName in CheckStyle (#5191)

* style: enable LocalVariableName in checkstyle

* Removed minor bug

* Resolved Method Name Bug

* Changed names according to suggestions
This commit is contained in:
S. Utkarsh
2024-05-28 23:59:28 +05:30
committed by GitHub
parent 81cb09b1f8
commit 25d711c5d8
45 changed files with 418 additions and 417 deletions

View File

@@ -112,10 +112,10 @@ public class AVLSimple {
private Node rightRotate(Node c) {
Node b = c.left;
Node T3 = b.right;
Node t3 = b.right;
b.right = c;
c.left = T3;
c.left = t3;
c.height = Math.max(height(c.left), height(c.right)) + 1;
b.height = Math.max(height(b.left), height(b.right)) + 1;
return b;
@@ -123,10 +123,10 @@ public class AVLSimple {
private Node leftRotate(Node c) {
Node b = c.right;
Node T3 = b.left;
Node t3 = b.left;
b.left = c;
c.right = T3;
c.right = t3;
c.height = Math.max(height(c.left), height(c.right)) + 1;
b.height = Math.max(height(b.left), height(b.right)) + 1;
return b;

View File

@@ -60,13 +60,13 @@ class Tree {
HashSet<Integer> set = new HashSet<>();
// Create a queue and add root to it
Queue<QItem> Q = new LinkedList<QItem>();
Q.add(new QItem(root, 0)); // Horizontal distance of root is 0
Queue<QItem> queue = new LinkedList<QItem>();
queue.add(new QItem(root, 0)); // Horizontal distance of root is 0
// Standard BFS or level order traversal loop
while (!Q.isEmpty()) {
while (!queue.isEmpty()) {
// Remove the front item and get its details
QItem qi = Q.remove();
QItem qi = queue.remove();
int hd = qi.hd;
TreeNode n = qi.node;
@@ -79,10 +79,10 @@ class Tree {
// Enqueue left and right children of current node
if (n.left != null) {
Q.add(new QItem(n.left, hd - 1));
queue.add(new QItem(n.left, hd - 1));
}
if (n.right != null) {
Q.add(new QItem(n.right, hd + 1));
queue.add(new QItem(n.right, hd + 1));
}
}
}

View File

@@ -10,9 +10,9 @@ public class SegmentTree {
public SegmentTree(int n, int[] arr) {
this.n = n;
int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
int seg_size = 2 * (int) Math.pow(2, x) - 1;
int segSize = 2 * (int) Math.pow(2, x) - 1;
this.seg_t = new int[seg_size];
this.seg_t = new int[segSize];
this.arr = arr;
this.n = n;
constructTree(arr, 0, n - 1, 0);