mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-23 04:20:16 +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
@ -12,8 +12,24 @@ import java.util.HashMap;
|
||||
*/
|
||||
public class Anagrams {
|
||||
|
||||
// 4 approaches are provided for anagram checking. approach 2 and approach 3 are similar but
|
||||
// differ in running time.
|
||||
/**
|
||||
* 4 approaches are provided for anagram checking. approach 2 and approach 3 are similar but
|
||||
* differ in running time.
|
||||
* OUTPUT :
|
||||
* first string ="deal" second string ="lead"
|
||||
* Output: Anagram
|
||||
* Input and output is constant for all four approaches
|
||||
* 1st approach Time Complexity : O(n logn)
|
||||
* Auxiliary Space Complexity : O(1)
|
||||
* 2nd approach Time Complexity : O(n)
|
||||
* Auxiliary Space Complexity : O(1)
|
||||
* 3rd approach Time Complexity : O(n)
|
||||
* Auxiliary Space Complexity : O(1)
|
||||
* 4th approach Time Complexity : O(n)
|
||||
* Auxiliary Space Complexity : O(n)
|
||||
* 5th approach Time Complexity: O(n)
|
||||
* Auxiliary Space Complexity: O(1)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
String first = "deal";
|
||||
String second = "lead";
|
||||
@ -23,22 +39,6 @@ public class Anagrams {
|
||||
System.out.println(nm.approach1(first, second)); /* To activate methods for different approaches*/
|
||||
System.out.println(nm.approach3(first, second)); /* To activate methods for different approaches*/
|
||||
System.out.println(nm.approach4(first, second)); /* To activate methods for different approaches*/
|
||||
/**
|
||||
* OUTPUT :
|
||||
* first string ="deal" second string ="lead"
|
||||
* Output: Anagram
|
||||
* Input and output is constant for all four approaches
|
||||
* 1st approach Time Complexity : O(n logn)
|
||||
* Auxiliary Space Complexity : O(1)
|
||||
* 2nd approach Time Complexity : O(n)
|
||||
* Auxiliary Space Complexity : O(1)
|
||||
* 3rd approach Time Complexity : O(n)
|
||||
* Auxiliary Space Complexity : O(1)
|
||||
* 4th approach Time Complexity : O(n)
|
||||
* Auxiliary Space Complexity : O(n)
|
||||
* 5th approach Time Complexity: O(n)
|
||||
* Auxiliary Space Complexity: O(1)
|
||||
*/
|
||||
}
|
||||
|
||||
boolean approach1(String s, String t) {
|
||||
|
Reference in New Issue
Block a user