mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-25 05:22:39 +08:00
style: enable InvalidJavadocPosition
in checkstyle (#5237)
enable style InvalidJavadocPosition Co-authored-by: Samuel Facchinello <samuel.facchinello@piksel.com>
This commit is contained in:

committed by
GitHub

parent
39e065437c
commit
74e51990c1
@ -1,15 +1,13 @@
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
import java.math.BigInteger;
|
||||
/**
|
||||
* Wikipedia link for Automorphic Number : https://en.wikipedia.org/wiki/Automorphic_number
|
||||
* <a href="https://en.wikipedia.org/wiki/Automorphic_number">Automorphic Number</a>
|
||||
* A number is said to be an Automorphic, if it is present in the last digit(s)
|
||||
* of its square. Example- Let the number be 25, its square is 625. Since,
|
||||
* 25(The input number) is present in the last two digits of its square(625), it
|
||||
* is an Automorphic Number.
|
||||
*/
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public final class AutomorphicNumber {
|
||||
private AutomorphicNumber() {
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
/**
|
||||
* Author : Suraj Kumar Modi
|
||||
* https://github.com/skmodi649
|
||||
*/
|
||||
/**
|
||||
* @author <a href="https://github.com/skmodi649">Suraj Kumar Modi</a>
|
||||
* You are given a number n. You need to find the digital root of n.
|
||||
* DigitalRoot of a number is the recursive sum of its digits until we get a single digit number.
|
||||
*
|
||||
@ -20,8 +19,6 @@
|
||||
* which is not a single digit number, hence
|
||||
* sum of digit of 45 is 9 which is a single
|
||||
* digit number.
|
||||
*/
|
||||
/**
|
||||
* Algorithm :
|
||||
* Step 1 : Define a method digitalRoot(int n)
|
||||
* Step 2 : Define another method single(int n)
|
||||
@ -38,8 +35,6 @@
|
||||
* Step 5 : In main method simply take n as input and then call digitalRoot(int n) function and
|
||||
* print the result
|
||||
*/
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
final class DigitalRoot {
|
||||
private DigitalRoot() {
|
||||
}
|
||||
@ -53,6 +48,11 @@ final class DigitalRoot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Time Complexity: O((Number of Digits)^2) Auxiliary Space Complexity:
|
||||
* O(Number of Digits) Constraints: 1 <= n <= 10^7
|
||||
*/
|
||||
|
||||
// This function is used for finding the sum of the digits of number
|
||||
public static int single(int n) {
|
||||
if (n <= 9) { // if n becomes less than 10 than return n
|
||||
@ -63,7 +63,3 @@ final class DigitalRoot {
|
||||
} // n / 10 is the number obtained after removing the digit one by one
|
||||
// The Sum of digits is stored in the Stack memory and then finally returned
|
||||
}
|
||||
/**
|
||||
* Time Complexity: O((Number of Digits)^2) Auxiliary Space Complexity:
|
||||
* O(Number of Digits) Constraints: 1 <= n <= 10^7
|
||||
*/
|
||||
|
@ -1,18 +1,26 @@
|
||||
/**
|
||||
* Author : Siddhant Swarup Mallick
|
||||
* Github : https://github.com/siddhant2002
|
||||
*/
|
||||
|
||||
/** Program description - To find out the inverse square root of the given number*/
|
||||
|
||||
/** Wikipedia Link - https://en.wikipedia.org/wiki/Fast_inverse_square_root */
|
||||
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/siddhant2002">Siddhant Swarup Mallick</a>
|
||||
* Program description - To find out the inverse square root of the given number
|
||||
* <a href="https://en.wikipedia.org/wiki/Fast_inverse_square_root">Wikipedia</a>
|
||||
*/
|
||||
public final class FastInverseSqrt {
|
||||
private FastInverseSqrt() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the inverse square root of the given number upto 6 - 8 decimal places.
|
||||
* calculates the inverse square root of the given number and returns true if calculated answer
|
||||
* matches with given answer else returns false
|
||||
*
|
||||
* OUTPUT :
|
||||
* Input - number = 4522
|
||||
* Output: it calculates the inverse squareroot of a number and returns true with it matches the
|
||||
* given answer else returns false. 1st approach Time Complexity : O(1) Auxiliary Space Complexity :
|
||||
* O(1) Input - number = 4522 Output: it calculates the inverse squareroot of a number and returns
|
||||
* true with it matches the given answer else returns false. 2nd approach Time Complexity : O(1)
|
||||
* Auxiliary Space Complexity : O(1)
|
||||
*/
|
||||
public static boolean inverseSqrt(float number) {
|
||||
float x = number;
|
||||
float xhalf = 0.5f * x;
|
||||
@ -24,11 +32,10 @@ public final class FastInverseSqrt {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the inverse square root of the given number upto 6 - 8 decimal places.
|
||||
* Returns the inverse square root of the given number upto 14 - 16 decimal places.
|
||||
* calculates the inverse square root of the given number and returns true if calculated answer
|
||||
* matches with given answer else returns false
|
||||
*/
|
||||
|
||||
public static boolean inverseSqrt(double number) {
|
||||
double x = number;
|
||||
double xhalf = 0.5d * x;
|
||||
@ -41,18 +48,4 @@ public final class FastInverseSqrt {
|
||||
x *= number;
|
||||
return x == 1 / Math.sqrt(number);
|
||||
}
|
||||
/**
|
||||
* Returns the inverse square root of the given number upto 14 - 16 decimal places.
|
||||
* calculates the inverse square root of the given number and returns true if calculated answer
|
||||
* matches with given answer else returns false
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* OUTPUT :
|
||||
* Input - number = 4522
|
||||
* Output: it calculates the inverse squareroot of a number and returns true with it matches the
|
||||
* given answer else returns false. 1st approach Time Complexity : O(1) Auxiliary Space Complexity :
|
||||
* O(1) Input - number = 4522 Output: it calculates the inverse squareroot of a number and returns
|
||||
* true with it matches the given answer else returns false. 2nd approach Time Complexity : O(1)
|
||||
* Auxiliary Space Complexity : O(1)
|
||||
*/
|
||||
|
@ -1,12 +1,9 @@
|
||||
/**
|
||||
* Author : Siddhant Swarup Mallick
|
||||
* Github : https://github.com/siddhant2002
|
||||
*/
|
||||
|
||||
/** Program description - To find the FrizzyNumber*/
|
||||
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/siddhant2002">Siddhant Swarup Mallick</a>
|
||||
* Program description - To find the FrizzyNumber
|
||||
*/
|
||||
public final class FrizzyNumber {
|
||||
private FrizzyNumber() {
|
||||
}
|
||||
|
@ -5,9 +5,7 @@ package com.thealgorithms.maths;
|
||||
* numbered from 1 to n in clockwise order. More formally, moving clockwise from the ith friend
|
||||
* brings you to the (i+1)th friend for 1 <= i < n, and moving clockwise from the nth friend brings
|
||||
* you to the 1st friend.
|
||||
*/
|
||||
|
||||
/**
|
||||
The rules of the game are as follows:
|
||||
|
||||
1.Start at the 1st friend.
|
||||
@ -19,7 +17,6 @@ package com.thealgorithms.maths;
|
||||
|
||||
@author Kunal
|
||||
*/
|
||||
|
||||
public final class JosephusProblem {
|
||||
private JosephusProblem() {
|
||||
}
|
||||
|
@ -37,17 +37,17 @@ public final class PascalTriangle {
|
||||
*/
|
||||
|
||||
public static int[][] pascal(int n) {
|
||||
/**
|
||||
/*
|
||||
* @param arr An auxiliary array to store generated pascal triangle values
|
||||
* @return
|
||||
*/
|
||||
int[][] arr = new int[n][n];
|
||||
/**
|
||||
/*
|
||||
* @param line Iterate through every line and print integer(s) in it
|
||||
* @param i Represents the column number of the element we are currently on
|
||||
*/
|
||||
for (int line = 0; line < n; line++) {
|
||||
/**
|
||||
/*
|
||||
* @Every line has number of integers equal to line number
|
||||
*/
|
||||
for (int i = 0; i <= line; i++) {
|
||||
|
Reference in New Issue
Block a user