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

@ -13,13 +13,16 @@ public final class BinarySearch2dArray {
}
static int[] BinarySearch(int[][] arr, int target) {
int rowCount = arr.length, colCount = arr[0].length;
int rowCount = arr.length;
int colCount = arr[0].length;
if (rowCount == 1) {
return binarySearch(arr, target, 0, 0, colCount);
}
int startRow = 0, endRow = rowCount - 1, midCol = colCount / 2;
int startRow = 0;
int endRow = rowCount - 1;
int midCol = colCount / 2;
while (startRow < endRow - 1) {
int midRow = startRow + (endRow - startRow) / 2; // getting the index of middle row

View File

@ -23,7 +23,8 @@ class InterpolationSearch {
*/
public int find(int[] array, int key) {
// Find indexes of two corners
int start = 0, end = (array.length - 1);
int start = 0;
int end = (array.length - 1);
// Since array is sorted, an element present
// in array must be in range defined by corner

View File

@ -32,7 +32,10 @@ public final class IterativeBinarySearch implements SearchAlgorithm {
*/
@Override
public <T extends Comparable<T>> int find(T[] array, T key) {
int l, r, k, cmp;
int l;
int r;
int k;
int cmp;
l = 0;
r = array.length - 1;

View File

@ -42,7 +42,8 @@ public final class LinearSearchThread {
class Searcher extends Thread {
private final int[] arr;
private final int left, right;
private final int left;
private final int right;
private final int x;
private boolean found;

View File

@ -57,7 +57,10 @@ public final class SaddlebackSearch {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int[][] arr;
int i, j, rows = sc.nextInt(), col = sc.nextInt();
int i;
int j;
int rows = sc.nextInt();
int col = sc.nextInt();
arr = new int[rows][col];
for (i = 0; i < rows; i++) {
for (j = 0; j < col; j++) {