style: enable HideUtilityClassConstructor in checkstyle (#5147)

This commit is contained in:
Piotr Idzik
2024-05-08 08:58:29 +02:00
committed by GitHub
parent 030bb91d05
commit d3bb691f59
285 changed files with 895 additions and 339 deletions

View File

@ -11,7 +11,9 @@ import java.util.Scanner;
*
* We can also find the inverse of a matrix
*/
public class InverseOfMatrix {
public final class InverseOfMatrix {
private InverseOfMatrix() {
}
public static void main(String[] argv) {
Scanner input = new Scanner(System.in);

View File

@ -15,7 +15,9 @@ and the Reduce step, where the results from the Map step are combined to produce
* Wikipedia link : https://en.wikipedia.org/wiki/MapReduce
*/
public class MapReduce {
public final class MapReduce {
private MapReduce() {
}
/*
*Counting all the words frequency within a sentence.
*/

View File

@ -10,6 +10,8 @@ import java.util.List;
*/
public final class MedianOfMatrix {
private MedianOfMatrix() {
}
public static int median(List<List<Integer>> matrix) {
// Flatten the matrix into a 1D list

View File

@ -2,7 +2,9 @@ package com.thealgorithms.misc;
import java.util.Scanner;
public class PalindromePrime {
public final class PalindromePrime {
private PalindromePrime() {
}
public static void main(String[] args) { // Main funtion
Scanner in = new Scanner(System.in);

View File

@ -2,7 +2,9 @@ package com.thealgorithms.misc;
import java.util.Arrays;
public class RangeInSortedArray {
public final class RangeInSortedArray {
private RangeInSortedArray() {
}
public static void main(String[] args) {
// Testcases

View File

@ -11,7 +11,9 @@ import java.util.Scanner;
* For more information on the Dutch national flag algorithm refer
* https://en.wikipedia.org/wiki/Dutch_national_flag_problem
*/
public class Sort012D {
public final class Sort012D {
private Sort012D() {
}
public static void main(String[] args) {
Scanner np = new Scanner(System.in);

View File

@ -11,15 +11,17 @@ import java.util.Scanner;
* @author Ojasva Jain
*/
class Sparcity {
final class Sparsity {
private Sparsity() {
}
/*
* @return Sparcity of matrix
* @return Sparsity of matrix
*
* where sparcity = number of zeroes/total elements in matrix
* where sparsity = number of zeroes/total elements in matrix
*
*/
static double sparcity(double[][] mat) {
static double sparsity(double[][] mat) {
int zero = 0;
// Traversing the matrix to count number of zeroes
for (int i = 0; i < mat.length; i++) {
@ -29,7 +31,7 @@ class Sparcity {
}
}
}
// return sparcity
// return sparsity
return ((double) zero / (mat.length * mat[1].length));
}
@ -48,7 +50,7 @@ class Sparcity {
mat[i][j] = in.nextDouble();
}
}
System.out.println("Sparcity of matrix is: " + sparcity(mat));
System.out.println("Sparsity of matrix is: " + sparsity(mat));
in.close();
}
}

View File

@ -8,7 +8,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
public class WordBoggle {
public final class WordBoggle {
private WordBoggle() {
}
/**
* O(nm * 8^s + ws) time where n = width of boggle board, m = height of

View File

@ -18,7 +18,9 @@ import java.util.Scanner;
* @version 11.0.9
* @since 2014-03-31
*/
public class matrixTranspose {
public final class matrixTranspose {
private matrixTranspose() {
}
public static void main(String[] args) {
/*