style: enable AvoidStarImport
in checkstyle (#5141)
This commit is contained in:
parent
dc47e0aa42
commit
414835db11
@ -120,7 +120,7 @@
|
|||||||
|
|
||||||
<!-- Checks for imports -->
|
<!-- Checks for imports -->
|
||||||
<!-- See https://checkstyle.org/checks/imports/index.html -->
|
<!-- See https://checkstyle.org/checks/imports/index.html -->
|
||||||
<!-- TODO <module name="AvoidStarImport"/> -->
|
<module name="AvoidStarImport"/>
|
||||||
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
||||||
<module name="RedundantImport"/>
|
<module name="RedundantImport"/>
|
||||||
<module name="UnusedImports">
|
<module name="UnusedImports">
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
/**Wikipedia link -> https://en.wikipedia.org/wiki/Shortest_path_problem */
|
/**Wikipedia link -> https://en.wikipedia.org/wiki/Shortest_path_problem */
|
||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AllPathsFromSourceToTarget {
|
public class AllPathsFromSourceToTarget {
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all permutations of 1...n of length k
|
* Finds all permutations of 1...n of length k
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all permutations of given array
|
* Finds all permutations of given array
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Problem Statement: -
|
* Problem Statement: -
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
|
* @author Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
|
||||||
|
@ -3,7 +3,12 @@ package com.thealgorithms.ciphers;
|
|||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import javax.crypto.*;
|
import javax.crypto.BadPaddingException;
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
import javax.crypto.KeyGenerator;
|
||||||
|
import javax.crypto.NoSuchPaddingException;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
import javax.crypto.spec.GCMParameterSpec;
|
import javax.crypto.spec.GCMParameterSpec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts any Binary Number to a Hexadecimal Number
|
* Converts any Binary Number to a Hexadecimal Number
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class RomanToInteger {
|
public class RomanToInteger {
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package com.thealgorithms.datastructures.dynamicarray;
|
package com.thealgorithms.datastructures.dynamicarray;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.ConcurrentModificationException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.thealgorithms.datastructures.graphs;
|
package com.thealgorithms.datastructures.graphs;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.PriorityQueue;
|
||||||
|
|
||||||
public class A_Star {
|
public class A_Star {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.datastructures.graphs;
|
package com.thealgorithms.datastructures.graphs;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
class BellmanFord /*
|
class BellmanFord /*
|
||||||
* Implementation of Bellman ford to detect negative cycles. Graph accepts
|
* Implementation of Bellman ford to detect negative cycles. Graph accepts
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.datastructures.heaps;
|
package com.thealgorithms.datastructures.heaps;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class GenericHeap<T extends Comparable<T>> {
|
public class GenericHeap<T extends Comparable<T>> {
|
||||||
|
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package com.thealgorithms.datastructures.lists;
|
package com.thealgorithms.datastructures.lists;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package com.thealgorithms.datastructures.trees;
|
package com.thealgorithms.datastructures.trees;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given tree is traversed in a 'post-order' way: LEFT -> RIGHT -> ROOT.
|
* Given tree is traversed in a 'post-order' way: LEFT -> RIGHT -> ROOT.
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package com.thealgorithms.datastructures.trees;
|
package com.thealgorithms.datastructures.trees;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a binary tree.
|
* Given a binary tree.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.maths;
|
package com.thealgorithms.maths;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Ojasva Jain
|
* @author Ojasva Jain
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.thealgorithms.maths;
|
package com.thealgorithms.maths;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class KaprekarNumbers {
|
public class KaprekarNumbers {
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.maths;
|
package com.thealgorithms.maths;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
class KeithNumber {
|
class KeithNumber {
|
||||||
|
|
||||||
|
@ -5,7 +5,9 @@ A number is a Krishnamurthy number if the sum of the factorials of the digits of
|
|||||||
to the number itself. For example, 1, 2 and 145 are Krishnamurthy numbers. Krishnamurthy number is
|
to the number itself. For example, 1, 2 and 145 are Krishnamurthy numbers. Krishnamurthy number is
|
||||||
also referred to as a Strong number.
|
also referred to as a Strong number.
|
||||||
*/
|
*/
|
||||||
import java.io.*;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
public class KrishnamurthyNumber {
|
public class KrishnamurthyNumber {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.maths;
|
package com.thealgorithms.maths;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a common mathematics concept to find the smallest value number
|
* Is a common mathematics concept to find the smallest value number
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.maths;
|
package com.thealgorithms.maths;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
/*A magic square of order n is an arrangement of distinct n^2 integers,in a square, such that the n
|
/*A magic square of order n is an arrangement of distinct n^2 integers,in a square, such that the n
|
||||||
numbers in all rows, all columns, and both diagonals sum to the same constant. A magic square
|
numbers in all rows, all columns, and both diagonals sum to the same constant. A magic square
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.misc;
|
package com.thealgorithms.misc;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class RangeInSortedArray {
|
public class RangeInSortedArray {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.misc;
|
package com.thealgorithms.misc;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The array is divided into four sections: a[1..Lo-1] zeroes a[Lo..Mid-1] ones
|
* The array is divided into four sections: a[1..Lo-1] zeroes a[Lo..Mid-1] ones
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.misc;
|
package com.thealgorithms.misc;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*A matrix is sparse if many of its coefficients are zero (In general if 2/3rd of matrix elements
|
*A matrix is sparse if many of its coefficients are zero (In general if 2/3rd of matrix elements
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
package com.thealgorithms.misc;
|
package com.thealgorithms.misc;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class ThreeSumProblem {
|
public class ThreeSumProblem {
|
||||||
|
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
package com.thealgorithms.misc;
|
package com.thealgorithms.misc;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class WordBoggle {
|
public class WordBoggle {
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.others;
|
package com.thealgorithms.others;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Conway {
|
public class Conway {
|
||||||
|
|
||||||
|
@ -15,7 +15,10 @@ package com.thealgorithms.others;
|
|||||||
* https://rosettacode.org/wiki/Dijkstra%27s_algorithm#Java Also most of the
|
* https://rosettacode.org/wiki/Dijkstra%27s_algorithm#Java Also most of the
|
||||||
* comments are from RosettaCode.
|
* comments are from RosettaCode.
|
||||||
*/
|
*/
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.NavigableSet;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
public class Dijkstra {
|
public class Dijkstra {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.others;
|
package com.thealgorithms.others;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class InsertDeleteInArray {
|
public class InsertDeleteInArray {
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.others;
|
package com.thealgorithms.others;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.BasicStroke;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.others;
|
package com.thealgorithms.others;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.others;
|
package com.thealgorithms.others;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
class PageRank {
|
class PageRank {
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ package com.thealgorithms.others;
|
|||||||
* Given a matrix of size n x n We have to rotate this matrix by 90 Degree Here
|
* Given a matrix of size n x n We have to rotate this matrix by 90 Degree Here
|
||||||
* is the algorithm for this problem .
|
* is the algorithm for this problem .
|
||||||
*/
|
*/
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
class Rotate_by_90_degree {
|
class Rotate_by_90_degree {
|
||||||
|
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
package com.thealgorithms.others;
|
package com.thealgorithms.others;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.FileInputStream;
|
||||||
import java.util.*;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/* display the most frequent K words in the file and the times it appear
|
/* display the most frequent K words in the file and the times it appear
|
||||||
in the file – shown in order (ignore case and periods) */
|
in the file – shown in order (ignore case and periods) */
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.thealgorithms.scheduling;
|
package com.thealgorithms.scheduling;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.PriorityQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preemptive Priority Scheduling Algorithm
|
* Preemptive Priority Scheduling Algorithm
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package com.thealgorithms.searches;
|
package com.thealgorithms.searches;
|
||||||
|
|
||||||
import com.thealgorithms.datastructures.Node;
|
import com.thealgorithms.datastructures.Node;
|
||||||
import java.util.*;
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: caos321
|
* @author: caos321
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.searches;
|
package com.thealgorithms.searches;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Problem Statement:
|
Problem Statement:
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.thealgorithms.searches;
|
package com.thealgorithms.searches;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the Quickselect algorithm as described
|
* An implementation of the Quickselect algorithm as described
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Explanation:- https://www.tutorialspoint.com/java-program-for-binary-search-recursive
|
// Explanation:- https://www.tutorialspoint.com/java-program-for-binary-search-recursive
|
||||||
package com.thealgorithms.searches;
|
package com.thealgorithms.searches;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
|
||||||
// Create a SearchAlgorithm class with a generic type
|
// Create a SearchAlgorithm class with a generic type
|
||||||
abstract class SearchAlgorithm<T extends Comparable<T>> {
|
abstract class SearchAlgorithm<T extends Comparable<T>> {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.searches;
|
package com.thealgorithms.searches;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class UnionFind {
|
public class UnionFind {
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Varun Upadhyay (https://github.com/varunu28)
|
* @author Varun Upadhyay (https://github.com/varunu28)
|
||||||
* @author Podshivalov Nikita (https://github.com/nikitap492)
|
* @author Podshivalov Nikita (https://github.com/nikitap492)
|
||||||
@ -21,8 +19,8 @@ class BubbleSort implements SortAlgorithm {
|
|||||||
for (int i = 1, size = array.length; i < size; ++i) {
|
for (int i = 1, size = array.length; i < size; ++i) {
|
||||||
boolean swapped = false;
|
boolean swapped = false;
|
||||||
for (int j = 0; j < size - i; ++j) {
|
for (int j = 0; j < size - i; ++j) {
|
||||||
if (greater(array[j], array[j + 1])) {
|
if (SortUtils.greater(array[j], array[j + 1])) {
|
||||||
swap(array, j, j + 1);
|
SortUtils.swap(array, j, j + 1);
|
||||||
swapped = true;
|
swapped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
public class CircleSort implements SortAlgorithm {
|
public class CircleSort implements SortAlgorithm {
|
||||||
|
|
||||||
/* This method implements the circle sort
|
/* This method implements the circle sort
|
||||||
@ -35,7 +33,7 @@ public class CircleSort implements SortAlgorithm {
|
|||||||
|
|
||||||
while (low < high) {
|
while (low < high) {
|
||||||
if (array[low].compareTo(array[high]) > 0) {
|
if (array[low].compareTo(array[high]) > 0) {
|
||||||
swap(array, low, high);
|
SortUtils.swap(array, low, high);
|
||||||
swapped = true;
|
swapped = true;
|
||||||
}
|
}
|
||||||
low++;
|
low++;
|
||||||
@ -43,7 +41,7 @@ public class CircleSort implements SortAlgorithm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (low == high && array[low].compareTo(array[high + 1]) > 0) {
|
if (low == high && array[low].compareTo(array[high + 1]) > 0) {
|
||||||
swap(array, low, high + 1);
|
SortUtils.swap(array, low, high + 1);
|
||||||
swapped = true;
|
swapped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comb Sort algorithm implementation
|
* Comb Sort algorithm implementation
|
||||||
*
|
*
|
||||||
@ -52,9 +50,9 @@ class CombSort implements SortAlgorithm {
|
|||||||
|
|
||||||
// Compare all elements with current gap
|
// Compare all elements with current gap
|
||||||
for (int i = 0; i < size - gap; i++) {
|
for (int i = 0; i < size - gap; i++) {
|
||||||
if (less(arr[i + gap], arr[i])) {
|
if (SortUtils.less(arr[i + gap], arr[i])) {
|
||||||
// Swap arr[i] and arr[i+gap]
|
// Swap arr[i] and arr[i+gap]
|
||||||
swap(arr, i, i + gap);
|
SortUtils.swap(arr, i, i + gap);
|
||||||
swapped = true;
|
swapped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,6 +86,6 @@ class CombSort implements SortAlgorithm {
|
|||||||
ob.sort(arr);
|
ob.sort(arr);
|
||||||
|
|
||||||
System.out.println("sorted array");
|
System.out.println("sorted array");
|
||||||
print(arr);
|
SortUtils.print(arr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,11 @@ import static com.thealgorithms.sorts.SortUtils.print;
|
|||||||
import static java.util.stream.Collectors.toList;
|
import static java.util.stream.Collectors.toList;
|
||||||
import static java.util.stream.Collectors.toMap;
|
import static java.util.stream.Collectors.toMap;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of gnome sort
|
* Implementation of gnome sort
|
||||||
*
|
*
|
||||||
@ -15,10 +13,10 @@ public class GnomeSort implements SortAlgorithm {
|
|||||||
int i = 1;
|
int i = 1;
|
||||||
int j = 2;
|
int j = 2;
|
||||||
while (i < arr.length) {
|
while (i < arr.length) {
|
||||||
if (less(arr[i - 1], arr[i])) {
|
if (SortUtils.less(arr[i - 1], arr[i])) {
|
||||||
i = j++;
|
i = j++;
|
||||||
} else {
|
} else {
|
||||||
swap(arr, i - 1, i);
|
SortUtils.swap(arr, i - 1, i);
|
||||||
if (--i == 0) {
|
if (--i == 0) {
|
||||||
i = j++;
|
i = j++;
|
||||||
}
|
}
|
||||||
@ -67,7 +65,7 @@ public class GnomeSort implements SortAlgorithm {
|
|||||||
gnomeSort.sort(strings);
|
gnomeSort.sort(strings);
|
||||||
|
|
||||||
System.out.println("After sort : ");
|
System.out.println("After sort : ");
|
||||||
print(integers);
|
SortUtils.print(integers);
|
||||||
print(strings);
|
SortUtils.print(strings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
class InsertionSort implements SortAlgorithm {
|
class InsertionSort implements SortAlgorithm {
|
||||||
@ -20,8 +18,8 @@ class InsertionSort implements SortAlgorithm {
|
|||||||
|
|
||||||
public <T extends Comparable<T>> T[] sort(T[] array, int lo, int hi) {
|
public <T extends Comparable<T>> T[] sort(T[] array, int lo, int hi) {
|
||||||
for (int i = lo; i < hi; i++) {
|
for (int i = lo; i < hi; i++) {
|
||||||
for (int j = i; j > lo && less(array[j], array[j - 1]); j--) {
|
for (int j = i; j > lo && SortUtils.less(array[j], array[j - 1]); j--) {
|
||||||
swap(array, j, j - 1);
|
SortUtils.swap(array, j, j - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
@ -45,13 +43,13 @@ class InsertionSort implements SortAlgorithm {
|
|||||||
// put the smallest element to the 0 position as a sentinel, which will allow us to avoid
|
// put the smallest element to the 0 position as a sentinel, which will allow us to avoid
|
||||||
// redundant comparisons like `j > 0` further
|
// redundant comparisons like `j > 0` further
|
||||||
for (int i = 1; i < n; i++)
|
for (int i = 1; i < n; i++)
|
||||||
if (less(array[i], array[minElemIndex])) minElemIndex = i;
|
if (SortUtils.less(array[i], array[minElemIndex])) minElemIndex = i;
|
||||||
swap(array, 0, minElemIndex);
|
SortUtils.swap(array, 0, minElemIndex);
|
||||||
|
|
||||||
for (int i = 2; i < n; i++) {
|
for (int i = 2; i < n; i++) {
|
||||||
int j = i;
|
int j = i;
|
||||||
T currentValue = array[i];
|
T currentValue = array[i];
|
||||||
while (less(currentValue, array[j - 1])) {
|
while (SortUtils.less(currentValue, array[j - 1])) {
|
||||||
array[j] = array[j - 1];
|
array[j] = array[j - 1];
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class LinkListSort {
|
public class LinkListSort {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/*This code implements the mergeSort algorithm without extra space
|
/*This code implements the mergeSort algorithm without extra space
|
||||||
For understanding about mergesort visit :https://www.geeksforgeeks.org/merge-sort/
|
For understanding about mergesort visit :https://www.geeksforgeeks.org/merge-sort/
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of pancake sort
|
* Implementation of pancake sort
|
||||||
*
|
*
|
||||||
@ -18,12 +16,12 @@ public class PancakeSort implements SortAlgorithm {
|
|||||||
T max = array[0];
|
T max = array[0];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int j = 0; j < size - i; j++) {
|
for (int j = 0; j < size - i; j++) {
|
||||||
if (less(max, array[j])) {
|
if (SortUtils.less(max, array[j])) {
|
||||||
max = array[j];
|
max = array[j];
|
||||||
index = j;
|
index = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flip(array, index, array.length - 1 - i);
|
SortUtils.flip(array, index, array.length - 1 - i);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
@ -62,6 +60,6 @@ public class PancakeSort implements SortAlgorithm {
|
|||||||
PancakeSort pancakeSort = new PancakeSort();
|
PancakeSort pancakeSort = new PancakeSort();
|
||||||
System.out.println("After sorting:");
|
System.out.println("After sorting:");
|
||||||
pancakeSort.sort(arr);
|
pancakeSort.sort(arr);
|
||||||
print(arr);
|
SortUtils.print(arr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class PigeonholeSort {
|
public class PigeonholeSort {
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ public class PigeonholeSort {
|
|||||||
Integer[] arr = {8, 3, 2, 7, 4, 6, 8};
|
Integer[] arr = {8, 3, 2, 7, 4, 6, 8};
|
||||||
|
|
||||||
System.out.print("Unsorted order is : ");
|
System.out.print("Unsorted order is : ");
|
||||||
print(arr);
|
SortUtils.print(arr);
|
||||||
|
|
||||||
pigeonholeSort.sort(arr);
|
pigeonholeSort.sort(arr);
|
||||||
|
|
||||||
@ -50,6 +48,6 @@ public class PigeonholeSort {
|
|||||||
for (int i = 0; i < arr.length; i++) {
|
for (int i = 0; i < arr.length; i++) {
|
||||||
assert (arr[i]) <= (arr[i + 1]);
|
assert (arr[i]) <= (arr[i + 1]);
|
||||||
}
|
}
|
||||||
print(arr);
|
SortUtils.print(arr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Varun Upadhyay (https://github.com/varunu28)
|
* @author Varun Upadhyay (https://github.com/varunu28)
|
||||||
* @author Podshivalov Nikita (https://github.com/nikitap492)
|
* @author Podshivalov Nikita (https://github.com/nikitap492)
|
||||||
@ -45,7 +43,7 @@ class QuickSort implements SortAlgorithm {
|
|||||||
*/
|
*/
|
||||||
private static <T extends Comparable<T>> int randomPartition(T[] array, int left, int right) {
|
private static <T extends Comparable<T>> int randomPartition(T[] array, int left, int right) {
|
||||||
int randomIndex = left + (int) (Math.random() * (right - left + 1));
|
int randomIndex = left + (int) (Math.random() * (right - left + 1));
|
||||||
swap(array, randomIndex, right);
|
SortUtils.swap(array, randomIndex, right);
|
||||||
return partition(array, left, right);
|
return partition(array, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,14 +60,14 @@ class QuickSort implements SortAlgorithm {
|
|||||||
T pivot = array[mid];
|
T pivot = array[mid];
|
||||||
|
|
||||||
while (left <= right) {
|
while (left <= right) {
|
||||||
while (less(array[left], pivot)) {
|
while (SortUtils.less(array[left], pivot)) {
|
||||||
++left;
|
++left;
|
||||||
}
|
}
|
||||||
while (less(pivot, array[right])) {
|
while (SortUtils.less(pivot, array[right])) {
|
||||||
--right;
|
--right;
|
||||||
}
|
}
|
||||||
if (left <= right) {
|
if (left <= right) {
|
||||||
swap(array, left, right);
|
SortUtils.swap(array, left, right);
|
||||||
++left;
|
++left;
|
||||||
--right;
|
--right;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
public class ShellSort implements SortAlgorithm {
|
public class ShellSort implements SortAlgorithm {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +23,7 @@ public class ShellSort implements SortAlgorithm {
|
|||||||
for (int i = gap; i < length; i++) {
|
for (int i = gap; i < length; i++) {
|
||||||
int j;
|
int j;
|
||||||
T temp = array[i];
|
T temp = array[i];
|
||||||
for (j = i; j >= gap && less(temp, array[j - gap]); j -= gap) {
|
for (j = i; j >= gap && SortUtils.less(temp, array[j - gap]); j -= gap) {
|
||||||
array[j] = array[j - gap];
|
array[j] = array[j - gap];
|
||||||
}
|
}
|
||||||
array[j] = temp;
|
array[j] = temp;
|
||||||
@ -43,6 +41,6 @@ public class ShellSort implements SortAlgorithm {
|
|||||||
for (int i = 0; i < toSort.length - 1; ++i) {
|
for (int i = 0; i < toSort.length - 1; ++i) {
|
||||||
assert toSort[i] <= toSort[i + 1];
|
assert toSort[i] <= toSort[i + 1];
|
||||||
}
|
}
|
||||||
print(toSort);
|
SortUtils.print(toSort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
public class SimpleSort implements SortAlgorithm {
|
public class SimpleSort implements SortAlgorithm {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -10,7 +8,7 @@ public class SimpleSort implements SortAlgorithm {
|
|||||||
|
|
||||||
for (int i = 0; i < LENGTH; i++) {
|
for (int i = 0; i < LENGTH; i++) {
|
||||||
for (int j = i + 1; j < LENGTH; j++) {
|
for (int j = i + 1; j < LENGTH; j++) {
|
||||||
if (less(array[j], array[i])) {
|
if (SortUtils.less(array[j], array[i])) {
|
||||||
T element = array[j];
|
T element = array[j];
|
||||||
array[j] = array[i];
|
array[j] = array[i];
|
||||||
array[i] = element;
|
array[i] = element;
|
||||||
@ -25,12 +23,12 @@ public class SimpleSort implements SortAlgorithm {
|
|||||||
// ==== Int =======
|
// ==== Int =======
|
||||||
Integer[] a = {3, 7, 45, 1, 33, 5, 2, 9};
|
Integer[] a = {3, 7, 45, 1, 33, 5, 2, 9};
|
||||||
System.out.print("unsorted: ");
|
System.out.print("unsorted: ");
|
||||||
print(a);
|
SortUtils.print(a);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
new SimpleSort().sort(a);
|
new SimpleSort().sort(a);
|
||||||
System.out.print("sorted: ");
|
System.out.print("sorted: ");
|
||||||
print(a);
|
SortUtils.print(a);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
// ==== String =======
|
// ==== String =======
|
||||||
@ -45,11 +43,11 @@ public class SimpleSort implements SortAlgorithm {
|
|||||||
"pineapple",
|
"pineapple",
|
||||||
};
|
};
|
||||||
System.out.print("unsorted: ");
|
System.out.print("unsorted: ");
|
||||||
print(b);
|
SortUtils.print(b);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
new SimpleSort().sort(b);
|
new SimpleSort().sort(b);
|
||||||
System.out.print("sorted: ");
|
System.out.print("sorted: ");
|
||||||
print(b);
|
SortUtils.print(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import static com.thealgorithms.sorts.SortUtils.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The idea of Swap-Sort is to count the number m of smaller values (that are in
|
* The idea of Swap-Sort is to count the number m of smaller values (that are in
|
||||||
* A) from each element of an array A(1...n) and then swap the element with the
|
* A) from each element of an array A(1...n) and then swap the element with the
|
||||||
@ -34,7 +32,7 @@ public class SwapSort implements SortAlgorithm {
|
|||||||
private <T extends Comparable<T>> int getSmallerElementCount(T[] array, int index) {
|
private <T extends Comparable<T>> int getSmallerElementCount(T[] array, int index) {
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (int i = 0; i < array.length; i++) {
|
for (int i = 0; i < array.length; i++) {
|
||||||
if (less(array[i], array[index])) {
|
if (SortUtils.less(array[i], array[index])) {
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,12 +44,12 @@ public class SwapSort implements SortAlgorithm {
|
|||||||
// ==== Int =======
|
// ==== Int =======
|
||||||
Integer[] a = {3, 7, 45, 1, 33, 5, 2, 9};
|
Integer[] a = {3, 7, 45, 1, 33, 5, 2, 9};
|
||||||
System.out.print("unsorted: ");
|
System.out.print("unsorted: ");
|
||||||
print(a);
|
SortUtils.print(a);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
new SwapSort().sort(a);
|
new SwapSort().sort(a);
|
||||||
System.out.print("sorted: ");
|
System.out.print("sorted: ");
|
||||||
print(a);
|
SortUtils.print(a);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
// ==== String =======
|
// ==== String =======
|
||||||
@ -66,11 +64,11 @@ public class SwapSort implements SortAlgorithm {
|
|||||||
"pineapple",
|
"pineapple",
|
||||||
};
|
};
|
||||||
System.out.print("unsorted: ");
|
System.out.print("unsorted: ");
|
||||||
print(b);
|
SortUtils.print(b);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
new SwapSort().sort(b);
|
new SwapSort().sort(b);
|
||||||
System.out.print("sorted: ");
|
System.out.print("sorted: ");
|
||||||
print(b);
|
SortUtils.print(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Topological Sorting algorithm linearly orders a DAG or Directed Acyclic Graph into
|
* The Topological Sorting algorithm linearly orders a DAG or Directed Acyclic Graph into
|
||||||
|
@ -8,7 +8,8 @@ package com.thealgorithms.stacks;
|
|||||||
// e.g.'
|
// e.g.'
|
||||||
// ((a + b) + (c + d)) -> false
|
// ((a + b) + (c + d)) -> false
|
||||||
// (a + b) + ((c + d)) -> true
|
// (a + b) + ((c + d)) -> true
|
||||||
import java.util.*;
|
import java.util.Scanner;
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
public class DuplicateBrackets {
|
public class DuplicateBrackets {
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.thealgorithms.strings;
|
package com.thealgorithms.strings;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class Isomorphic {
|
public class Isomorphic {
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.strings;
|
package com.thealgorithms.strings;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class LetterCombinationsOfPhoneNumber {
|
public class LetterCombinationsOfPhoneNumber {
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertIterableEquals;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class AllPathsFromSourceToTargetTest {
|
public class AllPathsFromSourceToTargetTest {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.backtracking;
|
package com.thealgorithms.backtracking;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.bitmanipulation;
|
package com.thealgorithms.bitmanipulation;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.bitmanipulation;
|
package com.thealgorithms.bitmanipulation;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.bitmanipulation;
|
package com.thealgorithms.bitmanipulation;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.bitmanipulation;
|
package com.thealgorithms.bitmanipulation;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.bitmanipulation;
|
package com.thealgorithms.bitmanipulation;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ package com.thealgorithms.bitmanipulation;
|
|||||||
* @author Bama Charan Chhandogi
|
* @author Bama Charan Chhandogi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.bitmanipulation;
|
package com.thealgorithms.bitmanipulation;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.ciphers;
|
package com.thealgorithms.ciphers;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.ciphers;
|
package com.thealgorithms.ciphers;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.ciphers;
|
package com.thealgorithms.ciphers;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.ciphers;
|
package com.thealgorithms.ciphers;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.conversions;
|
package com.thealgorithms.conversions;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
package com.thealgorithms.datastructures.buffers;
|
package com.thealgorithms.datastructures.buffers;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicIntegerArray;
|
import java.util.concurrent.atomic.AtomicIntegerArray;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.RepeatedTest;
|
import org.junit.jupiter.api.RepeatedTest;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.datastructures.crdt;
|
package com.thealgorithms.datastructures.crdt;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.datastructures.crdt;
|
package com.thealgorithms.datastructures.crdt;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.datastructures.crdt;
|
package com.thealgorithms.datastructures.crdt;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.datastructures.crdt;
|
package com.thealgorithms.datastructures.crdt;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.datastructures.crdt;
|
package com.thealgorithms.datastructures.crdt;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.thealgorithms.datastructures.crdt;
|
package com.thealgorithms.datastructures.crdt;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thealgorithms.datastructures.graphs;
|
package com.thealgorithms.datastructures.graphs;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import com.thealgorithms.datastructures.graphs.BoruvkaAlgorithm.Graph;
|
import com.thealgorithms.datastructures.graphs.BoruvkaAlgorithm.Graph;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.datastructures.graphs;
|
package com.thealgorithms.datastructures.graphs;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.thealgorithms.datastructures.hashmap;
|
package com.thealgorithms.datastructures.hashmap;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
import com.thealgorithms.datastructures.hashmap.hashing.HashMapCuckooHashing;
|
import com.thealgorithms.datastructures.hashmap.hashing.HashMapCuckooHashing;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.thealgorithms.datastructures.hashmap.hashing;
|
package com.thealgorithms.datastructures.hashmap.hashing;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.thealgorithms.datastructures.hashmap.hashing;
|
package com.thealgorithms.datastructures.hashmap.hashing;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thealgorithms.datastructures.hashmap.hashing;
|
package com.thealgorithms.datastructures.hashmap.hashing;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.thealgorithms.datastructures.hashmap.hashing;
|
package com.thealgorithms.datastructures.hashmap.hashing;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -6,7 +6,8 @@ package com.thealgorithms.datastructures.lists;
|
|||||||
* GitHub: https://github.com/Prabhat-Kumar-42
|
* GitHub: https://github.com/Prabhat-Kumar-42
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user