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

@ -8,7 +8,9 @@ package com.thealgorithms.others;
* @author sangin-lee
*/
public class ArrayLeftRotation {
public final class ArrayLeftRotation {
private ArrayLeftRotation() {
}
/*
* Returns the result of left rotation of given array arr and integer n

View File

@ -5,7 +5,9 @@ import java.util.Arrays;
/**
* BFPRT algorithm.
*/
public class BFPRT {
public final class BFPRT {
private BFPRT() {
}
public static int[] getMinKNumsByBFPRT(int[] arr, int k) {
if (k < 1 || k > arr.length) {

View File

@ -20,7 +20,9 @@ package com.thealgorithms.others;
*/
import java.util.Scanner;
public class BankersAlgorithm {
public final class BankersAlgorithm {
private BankersAlgorithm() {
}
/**
* This method finds the need of each process

View File

@ -20,7 +20,9 @@ import java.util.Scanner;
* <p>
* Time Complexity: O(logn)
*/
public class BrianKernighanAlgorithm {
public final class BrianKernighanAlgorithm {
private BrianKernighanAlgorithm() {
}
/**
* @param num: number in which we count the set bits

View File

@ -3,7 +3,9 @@ package com.thealgorithms.others;
/**
* Generates a crc16 checksum for a given string
*/
public class CRC16 {
public final class CRC16 {
private CRC16() {
}
public static void main(String[] args) {
System.out.println(crc16("Hello World!"));

View File

@ -5,7 +5,9 @@ import java.util.BitSet;
/**
* Generates a crc32 checksum for a given string or byte array
*/
public class CRC32 {
public final class CRC32 {
private CRC32() {
}
public static void main(String[] args) {
System.out.println(Integer.toHexString(crc32("Hello World")));

View File

@ -4,7 +4,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Conway {
public final class Conway {
private Conway() {
}
/*
* This class will generate the conway sequence also known as the look and say sequence.

View File

@ -1,6 +1,8 @@
package com.thealgorithms.others;
public class CountChar {
public final class CountChar {
private CountChar() {
}
/**
* Count non space character in string

View File

@ -14,7 +14,9 @@ import java.util.Objects;
* @see <a href="https://en.wikipedia.org/wiki/Damm_algorithm">Wiki. Damm
* algorithm</a>
*/
public class Damm {
public final class Damm {
private Damm() {
}
/**
* Weakly totally anti-symmetric quasigroup of order 10. This table is not

View File

@ -20,7 +20,9 @@ import java.util.Map;
import java.util.NavigableSet;
import java.util.TreeSet;
public class Dijkstra {
public final class Dijkstra {
private Dijkstra() {
}
private static final Graph.Edge[] GRAPH = {
// Distance from node "a" to node "b" is 7.

View File

@ -15,7 +15,9 @@ import java.util.Scanner;
* Problem Statement: print all Fibonacci numbers that are smaller than your
* given input N
*/
public class FibbonaciSeries {
public final class FibbonaciSeries {
private FibbonaciSeries() {
}
public static void main(String[] args) {
// Get input from the user

View File

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

View File

@ -6,7 +6,9 @@ package com.thealgorithms.others;
*
* @author AKS1996
*/
public class GuassLegendre {
public final class GuassLegendre {
private GuassLegendre() {
}
public static void main(String[] args) {
for (int i = 1; i <= 3; ++i) {

View File

@ -5,7 +5,9 @@ import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class HappyNumbersSeq {
public final class HappyNumbersSeq {
private HappyNumbersSeq() {
}
private static final Set<Integer> CYCLE_NUMS = new HashSet<>(Arrays.asList(4, 16, 20, 37, 58, 145));

View File

@ -26,7 +26,9 @@ class MyComparator implements Comparator<HuffmanNode> {
}
}
public class Huffman {
public final class Huffman {
private Huffman() {
}
// recursive function to print the
// huffman-code through the tree traversal.

View File

@ -2,7 +2,9 @@ package com.thealgorithms.others;
import java.util.Scanner;
public class InsertDeleteInArray {
public final class InsertDeleteInArray {
private InsertDeleteInArray() {
}
public static void main(String[] args) {
try (Scanner s = new Scanner(System.in)) {

View File

@ -4,7 +4,9 @@ package com.thealgorithms.others;
* Implementation of KnuthMorrisPratt algorithm Usage: see the main function
* for an example
*/
public class KMP {
public final class KMP {
private KMP() {
}
// a working example

View File

@ -24,7 +24,9 @@ import javax.imageio.ImageIO;
* https://natureofcode.com/book/chapter-8-fractals/
* #84-the-koch-curve-and-the-arraylist-technique ).
*/
public class KochSnowflake {
public final class KochSnowflake {
private KochSnowflake() {
}
public static void main(String[] args) {
// Test Iterate-method

View File

@ -2,7 +2,9 @@ package com.thealgorithms.others;
import java.util.Scanner;
class Krishnamurthy {
final class Krishnamurthy {
private Krishnamurthy() {
}
static int fact(int n) {
int i, p = 1;

View File

@ -11,7 +11,9 @@ import java.util.Comparator;
* https://en.wikipedia.org/wiki/Sweep_line_algorithm
* https://en.wikipedia.org/wiki/De_Morgan%27s_laws>
*/
public class LineSweep {
public final class LineSweep {
private LineSweep() {
}
/**
* Find Maximum end point

View File

@ -38,7 +38,9 @@ import java.util.Objects;
*
* @see <a href="https://en.wikipedia.org/wiki/Luhn_algorithm">Wiki</a>
*/
public class Luhn {
public final class Luhn {
private Luhn() {
}
/**
* Check input digits array by Luhn algorithm. Initial array doesn't change

View File

@ -23,7 +23,9 @@ import javax.imageio.ImageIO;
* also https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set
* )
*/
public class Mandelbrot {
public final class Mandelbrot {
private Mandelbrot() {
}
public static void main(String[] args) {
// Test black and white

View File

@ -8,7 +8,9 @@ References: https://en.wikipedia.org/wiki/Streaming_algorithm
* items from the end of the window are removed from consideration while new items from the stream take their place.
* @author Swarga-codes (https://github.com/Swarga-codes)
*/
public class MaximumSumOfDistinctSubarraysWithLengthK {
public final class MaximumSumOfDistinctSubarraysWithLengthK {
private MaximumSumOfDistinctSubarraysWithLengthK() {
}
/*
* Returns the maximum sum of subarray of size K consisting of distinct
* elements.

View File

@ -11,11 +11,8 @@ import java.util.Random;
* @author AKS1996
* @date 2017.10.25
*/
class PasswordGen {
public static void main(String[] args) {
String password = generatePassword(8, 16);
System.out.print("Password: " + password);
final class PasswordGen {
private PasswordGen() {
}
static String generatePassword(int min_length, int max_length) {

View File

@ -7,7 +7,9 @@ import java.util.Scanner;
* For detailed info and implementation see: <a
* href="http://devmag.org.za/2009/04/25/perlin-noise/">Perlin-Noise</a>
*/
public class PerlinNoise {
public final class PerlinNoise {
private PerlinNoise() {
}
/**
* @param width width of noise array

View File

@ -112,7 +112,9 @@ class QueueWithStack {
*
* @author sahilb2 (https://www.github.com/sahilb2)
*/
public class QueueUsingTwoStacks {
public final class QueueUsingTwoStacks {
private QueueUsingTwoStacks() {
}
/**
* Main method

View File

@ -7,7 +7,9 @@ import java.util.Scanner;
// An implementation of Rabin-Karp string matching algorithm
// Program will simply end if there is no match
public class RabinKarp {
public final class RabinKarp {
private RabinKarp() {
}
public static Scanner SCANNER = null;
public static final int ALPHABET_SIZE = 256;

View File

@ -6,7 +6,9 @@ import java.io.InputStreamReader;
/**
* @author Varun Upadhyay (https://github.com/varunu28)
*/
public class RemoveDuplicateFromString {
public final class RemoveDuplicateFromString {
private RemoveDuplicateFromString() {
}
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

View File

@ -2,7 +2,9 @@ package com.thealgorithms.others;
import java.util.Scanner;
public class ReturnSubsequence {
public final class ReturnSubsequence {
private ReturnSubsequence() {
}
public static void main(String[] args) {
System.out.println("Enter String: ");

View File

@ -3,7 +3,9 @@ package com.thealgorithms.others;
/* Program to reverse a Stack using Recursion*/
import java.util.Stack;
public class ReverseStackUsingRecursion {
public final class ReverseStackUsingRecursion {
private ReverseStackUsingRecursion() {
}
// Stack
private static Stack<Integer> stack = new Stack<>();

View File

@ -2,7 +2,9 @@ package com.thealgorithms.others;
import java.util.Scanner;
public class RootPrecision {
public final class RootPrecision {
private RootPrecision() {
}
public static void main(String[] args) {
// take input

View File

@ -6,7 +6,9 @@ package com.thealgorithms.others;
*/
import java.util.Scanner;
class Rotate_by_90_degree {
class Rotate_by_90_degrees {
private Rotate_by_90_degrees() {
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
@ -41,7 +43,9 @@ class Rotate_by_90_degree {
/**
* Class containing the algo to roate matrix by 90 degree
*/
class Rotate {
final class Rotate {
private Rotate() {
}
static void rotate(int[][] a) {
int n = a.length;

View File

@ -6,7 +6,9 @@ package com.thealgorithms.others;
import java.util.Scanner;
// An implementaion of string matching using finite automata
public class StringMatchFiniteAutomata {
public final class StringMatchFiniteAutomata {
private StringMatchFiniteAutomata() {
}
public static final int CHARS = 256;
public static int[][] FA;

View File

@ -1,6 +1,8 @@
package com.thealgorithms.others;
class Sudoku {
final class Sudoku {
private Sudoku() {
}
public static boolean isSafe(int[][] board, int row, int col, int num) {
// Row has the unique (row-clash)

View File

@ -11,7 +11,9 @@ import java.util.Scanner;
/* display the most frequent K words in the file and the times it appear
in the file shown in order (ignore case and periods) */
public class TopKWords {
public final class TopKWords {
private TopKWords() {
}
static class CountWords {

View File

@ -2,7 +2,9 @@ package com.thealgorithms.others;
import java.util.Scanner;
class TowerOfHanoi {
final class TowerOfHanoi {
private TowerOfHanoi() {
}
public static void shift(int n, String startPole, String intermediatePole, String endPole) {
// if n becomes zero the program returns thus ending the loop.

View File

@ -9,7 +9,9 @@ import java.util.Arrays;
* <p>
* link: https://www.geeksforgeeks.org/two-pointers-technique/
*/
class TwoPointers {
final class TwoPointers {
private TwoPointers() {
}
/**
* Given a sorted array arr (sorted in ascending order). Find if there

View File

@ -23,7 +23,9 @@ import java.util.Objects;
* @see <a href="https://en.wikipedia.org/wiki/Verhoeff_algorithm">Wiki.
* Verhoeff algorithm</a>
*/
public class Verhoeff {
public final class Verhoeff {
private Verhoeff() {
}
/**
* Table {@code d}. Based on multiplication in the dihedral group D5 and is