style: enable TypeName
(#5214)
* style: enable `TypeName` in checkstyle * style: enable `TypeName` in checkstyle * Update directory * style: use proper formatting --------- Co-authored-by: StarDxxx <StarDxxx@users.noreply.github.com> Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
This commit is contained in:
parent
be38886d43
commit
a81fb32e6c
26
DIRECTORY.md
26
DIRECTORY.md
@ -18,6 +18,7 @@
|
||||
* [ParenthesesGenerator](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/backtracking/ParenthesesGenerator.java)
|
||||
* [Permutation](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/backtracking/Permutation.java)
|
||||
* [PowerSum](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/backtracking/PowerSum.java)
|
||||
* [SubsequenceFinder](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/backtracking/SubsequenceFinder.java)
|
||||
* [WordSearch](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/backtracking/WordSearch.java)
|
||||
* bitmanipulation
|
||||
* [BitSwap](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/bitmanipulation/BitSwap.java)
|
||||
@ -96,7 +97,7 @@
|
||||
* dynamicarray
|
||||
* [DynamicArray](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/dynamicarray/DynamicArray.java)
|
||||
* graphs
|
||||
* [A Star](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/graphs/A_Star.java)
|
||||
* [AStar](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/graphs/AStar.java)
|
||||
* [BellmanFord](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/graphs/BellmanFord.java)
|
||||
* [BipartiteGrapfDFS](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/graphs/BipartiteGrapfDFS.java)
|
||||
* [BoruvkaAlgorithm](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/graphs/BoruvkaAlgorithm.java)
|
||||
@ -141,7 +142,7 @@
|
||||
* [CreateAndDetectLoop](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/lists/CreateAndDetectLoop.java)
|
||||
* [CursorLinkedList](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/lists/CursorLinkedList.java)
|
||||
* [DoublyLinkedList](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/lists/DoublyLinkedList.java)
|
||||
* [Merge K SortedLinkedlist](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/lists/Merge_K_SortedLinkedlist.java)
|
||||
* [MergeKSortedLinkedlist](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/lists/MergeKSortedLinkedlist.java)
|
||||
* [MergeSortedArrayList](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/lists/MergeSortedArrayList.java)
|
||||
* [MergeSortedSinglyLinkedList](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/lists/MergeSortedSinglyLinkedList.java)
|
||||
* [QuickSortLinkedList](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/lists/QuickSortLinkedList.java)
|
||||
@ -376,7 +377,7 @@
|
||||
* [ColorContrastRatio](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/misc/ColorContrastRatio.java)
|
||||
* [InverseOfMatrix](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/misc/InverseOfMatrix.java)
|
||||
* [MapReduce](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/misc/MapReduce.java)
|
||||
* [matrixTranspose](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/misc/matrixTranspose.java)
|
||||
* [MatrixTranspose](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/misc/MatrixTranspose.java)
|
||||
* [MedianOfMatrix](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/misc/MedianOfMatrix.java)
|
||||
* [MedianOfRunningArray](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/misc/MedianOfRunningArray.java)
|
||||
* [MedianOfRunningArrayByte](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/misc/MedianOfRunningArrayByte.java)
|
||||
@ -403,7 +404,7 @@
|
||||
* [HammingDistance](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/cn/HammingDistance.java)
|
||||
* [Conway](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/Conway.java)
|
||||
* [CountChar](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/CountChar.java)
|
||||
* [countSetBits](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/countSetBits.java)
|
||||
* [CountSetBits](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/CountSetBits.java)
|
||||
* [CountWords](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/CountWords.java)
|
||||
* [CRC16](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/CRC16.java)
|
||||
* [CRC32](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/CRC32.java)
|
||||
@ -478,7 +479,7 @@
|
||||
* [RowColumnWiseSorted2dArrayBinarySearch](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/RowColumnWiseSorted2dArrayBinarySearch.java)
|
||||
* [SaddlebackSearch](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/SaddlebackSearch.java)
|
||||
* [SearchInARowAndColWiseSortedMatrix](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/SearchInARowAndColWiseSortedMatrix.java)
|
||||
* [sortOrderAgnosticBinarySearch](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/sortOrderAgnosticBinarySearch.java)
|
||||
* [SortOrderAgnosticBinarySearch](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/SortOrderAgnosticBinarySearch.java)
|
||||
* [SquareRootBinarySearch](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/SquareRootBinarySearch.java)
|
||||
* [TernarySearch](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/TernarySearch.java)
|
||||
* [UnionFind](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/searches/UnionFind.java)
|
||||
@ -549,7 +550,7 @@
|
||||
* [HorspoolSearch](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/HorspoolSearch.java)
|
||||
* [Isomorphic](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/Isomorphic.java)
|
||||
* [LetterCombinationsOfPhoneNumber](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/LetterCombinationsOfPhoneNumber.java)
|
||||
* [longestNonRepeativeSubstring](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/longestNonRepeativeSubstring.java)
|
||||
* [LongestNonRepeativeSubstring](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/LongestNonRepeativeSubstring.java)
|
||||
* [LongestPalindromicSubstring](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/LongestPalindromicSubstring.java)
|
||||
* [Lower](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/Lower.java)
|
||||
* [MyAtoi](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/MyAtoi.java)
|
||||
@ -565,7 +566,7 @@
|
||||
* [ValidParentheses](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/ValidParentheses.java)
|
||||
* [WordLadder](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/WordLadder.java)
|
||||
* zigZagPattern
|
||||
* [zigZagPattern](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/zigZagPattern/zigZagPattern.java)
|
||||
* [ZigZagPattern](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/strings/zigZagPattern/ZigZagPattern.java)
|
||||
* test
|
||||
* java
|
||||
* com
|
||||
@ -580,6 +581,7 @@
|
||||
* [ParenthesesGeneratorTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/backtracking/ParenthesesGeneratorTest.java)
|
||||
* [PermutationTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/backtracking/PermutationTest.java)
|
||||
* [PowerSumTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/backtracking/PowerSumTest.java)
|
||||
* [SubsequenceFinderTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/backtracking/SubsequenceFinderTest.java)
|
||||
* [WordSearchTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/backtracking/WordSearchTest.java)
|
||||
* bitmanipulation
|
||||
* [BitSwapTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/bitmanipulation/BitSwapTest.java)
|
||||
@ -684,7 +686,7 @@
|
||||
* [StrassenMatrixMultiplicationTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/divideandconquer/StrassenMatrixMultiplicationTest.java)
|
||||
* dynamicprogramming
|
||||
* [CatalanNumberTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/dynamicprogramming/CatalanNumberTest.java)
|
||||
* [climbStairsTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/dynamicprogramming/climbStairsTest.java)
|
||||
* [ClimbStairsTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/dynamicprogramming/ClimbStairsTest.java)
|
||||
* [EggDroppingTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/dynamicprogramming/EggDroppingTest.java)
|
||||
* [KnapsackMemoizationTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/dynamicprogramming/KnapsackMemoizationTest.java)
|
||||
* [KnapsackTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/dynamicprogramming/KnapsackTest.java)
|
||||
@ -812,7 +814,7 @@
|
||||
* [ConwayTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/ConwayTest.java)
|
||||
* [CountCharTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/CountCharTest.java)
|
||||
* [CountFriendsPairingTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/CountFriendsPairingTest.java)
|
||||
* [countSetBitsTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/countSetBitsTest.java)
|
||||
* [CountSetBitsTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/CountSetBitsTest.java)
|
||||
* [CountWordsTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/CountWordsTest.java)
|
||||
* [CRC16Test](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/CRC16Test.java)
|
||||
* [CRCAlgorithmTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/others/CRCAlgorithmTest.java)
|
||||
@ -848,7 +850,7 @@
|
||||
* [RabinKarpAlgorithmTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/searches/RabinKarpAlgorithmTest.java)
|
||||
* [RecursiveBinarySearchTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/searches/RecursiveBinarySearchTest.java)
|
||||
* [RowColumnWiseSorted2dArrayBinarySearchTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/searches/RowColumnWiseSorted2dArrayBinarySearchTest.java)
|
||||
* [sortOrderAgnosticBinarySearchTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/searches/sortOrderAgnosticBinarySearchTest.java)
|
||||
* [SortOrderAgnosticBinarySearchTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/searches/SortOrderAgnosticBinarySearchTest.java)
|
||||
* [TestSearchInARowAndColWiseSortedMatrix](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/searches/TestSearchInARowAndColWiseSortedMatrix.java)
|
||||
* sorts
|
||||
* [BeadSortTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/sorts/BeadSortTest.java)
|
||||
@ -896,7 +898,7 @@
|
||||
* [HorspoolSearchTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/HorspoolSearchTest.java)
|
||||
* [IsomorphicTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/IsomorphicTest.java)
|
||||
* [LetterCombinationsOfPhoneNumberTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/LetterCombinationsOfPhoneNumberTest.java)
|
||||
* [longestNonRepeativeSubstringTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/longestNonRepeativeSubstringTest.java)
|
||||
* [LongestNonRepeativeSubstringTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/LongestNonRepeativeSubstringTest.java)
|
||||
* [LowerTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/LowerTest.java)
|
||||
* [MyAtoiTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/MyAtoiTest.java)
|
||||
* [PalindromeTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/PalindromeTest.java)
|
||||
@ -910,4 +912,4 @@
|
||||
* [ValidParenthesesTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/ValidParenthesesTest.java)
|
||||
* [WordLadderTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/WordLadderTest.java)
|
||||
* zigZagPattern
|
||||
* [zigZagPatternTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/zigZagPattern/zigZagPatternTest.java)
|
||||
* [ZigZagPatternTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/strings/zigZagPattern/ZigZagPatternTest.java)
|
||||
|
@ -116,7 +116,7 @@
|
||||
<module name="PackageName"/>
|
||||
<module name="ParameterName"/>
|
||||
<module name="StaticVariableName"/>
|
||||
<!-- TODO <module name="TypeName"/> -->
|
||||
<module name="TypeName"/>
|
||||
|
||||
<!-- Checks for imports -->
|
||||
<!-- See https://checkstyle.org/checks/imports/index.html -->
|
||||
|
@ -10,7 +10,7 @@ com.thealgorithms.conversions.HexToOct=UselessParentheses
|
||||
com.thealgorithms.conversions.IntegerToRoman=UnnecessaryFullyQualifiedName
|
||||
com.thealgorithms.datastructures.crdt.LWWElementSet=UselessParentheses
|
||||
com.thealgorithms.datastructures.crdt.Pair=UnusedPrivateField
|
||||
com.thealgorithms.datastructures.graphs.A_Star=UselessParentheses
|
||||
com.thealgorithms.datastructures.graphs.AStar=UselessParentheses
|
||||
com.thealgorithms.datastructures.graphs.AdjacencyMatrixGraph=CollapsibleIfStatements,UnnecessaryFullyQualifiedName,UselessParentheses
|
||||
com.thealgorithms.datastructures.graphs.BipartiteGrapfDFS=CollapsibleIfStatements
|
||||
com.thealgorithms.datastructures.graphs.Kruskal=UselessParentheses
|
||||
|
@ -9,8 +9,8 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.PriorityQueue;
|
||||
|
||||
public final class A_Star {
|
||||
private A_Star() {
|
||||
public final class AStar {
|
||||
private AStar() {
|
||||
}
|
||||
|
||||
private static class Graph {
|
@ -4,7 +4,7 @@ for better understanding
|
||||
*/
|
||||
package com.thealgorithms.datastructures.graphs;
|
||||
|
||||
class dijkstras {
|
||||
class Dijkstras {
|
||||
|
||||
int k = 9;
|
||||
|
||||
@ -67,7 +67,7 @@ class dijkstras {
|
||||
{8, 11, 0, 0, 0, 0, 1, 0, 7},
|
||||
{0, 0, 2, 0, 0, 0, 6, 7, 0},
|
||||
};
|
||||
dijkstras t = new dijkstras();
|
||||
Dijkstras t = new Dijkstras();
|
||||
t.dijkstra(graph, 0);
|
||||
} // main
|
||||
} // djikstras
|
||||
|
@ -7,7 +7,7 @@ import java.util.PriorityQueue;
|
||||
/**
|
||||
* @author Arun Pandey (https://github.com/pandeyarun709)
|
||||
*/
|
||||
public class Merge_K_SortedLinkedlist {
|
||||
public class MergeKSortedLinkedlist {
|
||||
|
||||
/**
|
||||
* This function merge K sorted LinkedList
|
@ -27,6 +27,6 @@ The `next` variable points to the next node in the data structure and value stor
|
||||
3. `CountSinglyLinkedListRecursion.java`: Recursively counts the size of a list.
|
||||
4. `CreateAndDetectLoop.java` : Create and detect a loop in a linked list.
|
||||
5. `DoublyLinkedList.java` : A modification of singly linked list which has a `prev` pointer to point to the previous node.
|
||||
6. `Merge_K_SortedLinkedlist.java` : Merges K sorted linked list with mergesort (mergesort is also the most efficient sorting algorithm for linked list).
|
||||
6. `MergeKSortedLinkedlist.java` : Merges K sorted linked list with mergesort (mergesort is also the most efficient sorting algorithm for linked list).
|
||||
7. `RandomNode.java` : Selects a random node from given linked list and diplays it.
|
||||
8. `SkipList.java` : Data Structure used for storing a sorted list of elements with help of a Linked list hierarchy that connects to subsequences of elements.
|
||||
|
@ -18,8 +18,8 @@ import java.util.Scanner;
|
||||
* @version 11.0.9
|
||||
* @since 2014-03-31
|
||||
*/
|
||||
public final class matrixTranspose {
|
||||
private matrixTranspose() {
|
||||
public final class MatrixTranspose {
|
||||
private MatrixTranspose() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
@ -1,6 +1,6 @@
|
||||
package com.thealgorithms.others;
|
||||
|
||||
public class countSetBits {
|
||||
public class CountSetBits {
|
||||
|
||||
/**
|
||||
* The below algorithm is called as Brian Kernighan's algorithm
|
||||
@ -40,7 +40,7 @@ public class countSetBits {
|
||||
* @param num takes Long number whose number of set bit is to be found
|
||||
* @return the count of set bits in the binary equivalent
|
||||
*/
|
||||
public long countsetBits(long num) {
|
||||
public long countSetBits(long num) {
|
||||
long cnt = 0;
|
||||
while (num > 0) {
|
||||
cnt++;
|
@ -6,8 +6,8 @@ package com.thealgorithms.others;
|
||||
*/
|
||||
import java.util.Scanner;
|
||||
|
||||
final class Rotate_by_90_degrees {
|
||||
private Rotate_by_90_degrees() {
|
||||
final class RotateMatrixBy90Degrees {
|
||||
private RotateMatrixBy90Degrees() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.thealgorithms.searches;
|
||||
public final class sortOrderAgnosticBinarySearch {
|
||||
private sortOrderAgnosticBinarySearch() {
|
||||
public final class SortOrderAgnosticBinarySearch {
|
||||
private SortOrderAgnosticBinarySearch() {
|
||||
}
|
||||
public static int find(int[] arr, int key) {
|
||||
int start = 0;
|
@ -2,8 +2,8 @@ package com.thealgorithms.strings;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
final class longestNonRepeativeSubstring {
|
||||
private longestNonRepeativeSubstring() {
|
||||
final class LongestNonRepeativeSubstring {
|
||||
private LongestNonRepeativeSubstring() {
|
||||
}
|
||||
|
||||
public static int lengthOfLongestSubstring(String s) {
|
@ -1,7 +1,7 @@
|
||||
package com.thealgorithms.strings.zigZagPattern;
|
||||
|
||||
final class zigZagPattern {
|
||||
private zigZagPattern() {
|
||||
final class ZigZagPattern {
|
||||
private ZigZagPattern() {
|
||||
}
|
||||
|
||||
public static String encode(String s, int numRows) {
|
@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class climbStairsTest {
|
||||
public class ClimbStairsTest {
|
||||
|
||||
@Test
|
||||
void climbStairsTestForTwo() {
|
17
src/test/java/com/thealgorithms/others/CountSetBitsTest.java
Normal file
17
src/test/java/com/thealgorithms/others/CountSetBitsTest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.thealgorithms.others;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CountSetBitsTest {
|
||||
|
||||
@Test
|
||||
void testSetBits() {
|
||||
CountSetBits csb = new CountSetBits();
|
||||
assertEquals(1L, csb.countSetBits(16));
|
||||
assertEquals(4, csb.countSetBits(15));
|
||||
assertEquals(5, csb.countSetBits(10000));
|
||||
assertEquals(5, csb.countSetBits(31));
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package com.thealgorithms.others;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class countSetBitsTest {
|
||||
|
||||
@Test
|
||||
void testSetBits() {
|
||||
countSetBits csb = new countSetBits();
|
||||
assertEquals(1L, csb.countsetBits(16));
|
||||
assertEquals(4, csb.countsetBits(15));
|
||||
assertEquals(5, csb.countsetBits(10000));
|
||||
assertEquals(5, csb.countsetBits(31));
|
||||
}
|
||||
}
|
@ -4,13 +4,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class sortOrderAgnosticBinarySearchTest {
|
||||
public class SortOrderAgnosticBinarySearchTest {
|
||||
|
||||
@Test
|
||||
public void testAscending() {
|
||||
int[] arr = {1, 2, 3, 4, 5}; // for ascending order.
|
||||
int target = 2;
|
||||
int ans = sortOrderAgnosticBinarySearch.find(arr, target);
|
||||
int ans = SortOrderAgnosticBinarySearch.find(arr, target);
|
||||
int excepted = 1;
|
||||
assertEquals(excepted, ans);
|
||||
}
|
||||
@ -19,7 +19,7 @@ public class sortOrderAgnosticBinarySearchTest {
|
||||
public void testDescending() {
|
||||
int[] arr = {5, 4, 3, 2, 1}; // for descending order.
|
||||
int target = 2;
|
||||
int ans = sortOrderAgnosticBinarySearch.find(arr, target);
|
||||
int ans = SortOrderAgnosticBinarySearch.find(arr, target);
|
||||
int excepted = 3;
|
||||
assertEquals(excepted, ans);
|
||||
}
|
@ -3,13 +3,13 @@ package com.thealgorithms.strings;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class longestNonRepeativeSubstringTest {
|
||||
public class LongestNonRepeativeSubstringTest {
|
||||
|
||||
@Test
|
||||
public void palindrome() {
|
||||
String input1 = "HelloWorld";
|
||||
String input2 = "javaIsAProgrammingLanguage";
|
||||
Assertions.assertEquals(longestNonRepeativeSubstring.lengthOfLongestSubstring(input1), 5);
|
||||
Assertions.assertEquals(longestNonRepeativeSubstring.lengthOfLongestSubstring(input2), 9);
|
||||
Assertions.assertEquals(LongestNonRepeativeSubstring.lengthOfLongestSubstring(input1), 5);
|
||||
Assertions.assertEquals(LongestNonRepeativeSubstring.lengthOfLongestSubstring(input2), 9);
|
||||
}
|
||||
}
|
@ -3,13 +3,13 @@ package com.thealgorithms.strings.zigZagPattern;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class zigZagPatternTest {
|
||||
public class ZigZagPatternTest {
|
||||
|
||||
@Test
|
||||
public void palindrome() {
|
||||
String input1 = "HelloWorldFromJava";
|
||||
String input2 = "javaIsAProgrammingLanguage";
|
||||
Assertions.assertEquals(zigZagPattern.encode(input1, 4), "HooeWrrmalolFJvlda");
|
||||
Assertions.assertEquals(zigZagPattern.encode(input2, 4), "jAaLgasPrmgaaevIrgmnnuaoig");
|
||||
Assertions.assertEquals(ZigZagPattern.encode(input1, 4), "HooeWrrmalolFJvlda");
|
||||
Assertions.assertEquals(ZigZagPattern.encode(input2, 4), "jAaLgasPrmgaaevIrgmnnuaoig");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user