* modify code to make use of java Optional class
* revert changes
* add java.util.Optional<Integer>
* add java.util.Optional
* refactors: make `findmajor` return `optional`
* refactors: make method name findMajor and split it
* refactors: change method name in tests
* Apply suggestions from code review
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
* change back to int
* fix: swap arguments
* tests: add some test cases
* refactor: add `isMajority` and avoid rounding
* style: use `var`
* style: swap arguments of `countOccurrences`
---------
Co-authored-by: vil02 <vil02@o2.pl>
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
* Number of count of major element in Boyer Moore algorithm
* test: add `BoyerMooreTest`
* style: basic linting
* tests: add test case from the issue
---------
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Co-authored-by: vil02 <vil02@o2.pl>
* Made changes to the code to correct the Logic of Armstrong Number
* Resolved the issues
* Trying to resolve the Linter error by changing Variable name
* Changed Variable Names : trying to resolve Clang error
* Chnged the signature of the function
* Added the Function documentation
* Added exception for parameters
* Resolved with suggested changes
* Resolved with Suggested changes
* fix: use proper logic
---------
Co-authored-by: vil02 <vil02@o2.pl>
* Fixed Small typos :-)
* Update BufferedReader.java
* Made the following changes :
* Improved readability of files and removed gramatical errors.
* Implemented data assigning instead of manually calling arr.ylength in several instances like FindMax, FindMaxRecursion etc.
* Removed unwanted params from several files
* Implemented Math methods in files math/FindMinRecursion.java and FindMaxRecursion.java
* Update src/main/java/com/thealgorithms/maths/FindMinRecursion.java
---------
Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>
* adding formatting steps in contribution.md
* adding format to pull request template
* made format instruction shorter
---------
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
* Added code to find Articulation Points and Bridges
* tried to solve clang-formant test
* removed new line at EOF to get lint to pass
* feature: Added Ahocorasick Algorithm
* fixed lint using clang-format
* removed datastructures/graphs/ArticulationPointsAndBridge.java from this branch
* removed main, since test-file is added. Also modified and renamed few functions.
* Added test-file for AhoCorasick Algorithm
* Modified some comments in test-file
* Modified some comments in AhoCorasick.java
* lint fix
* added few more test cases
* Modified some comments
* Change all class fields to private, added initializeSuffixLinksForChildNodesOfTheRoot() method, hashmap string search position (also has previous index based search), removed java.util.*
* Added Missing Test-Cases and more
* minor text changes
* added direct test check i.e. defining a variable expected and just checking if res and expected are equal.
* Created New Class Trie, merged 'buildTrie and buildSuffixAndOutputLinks' with 'Trie constructor'. Merged setUpStartPoints with searchIn. Now AhoCorasick contains -> inner class: Trie, Node. Methods: search and convert. Trie has -> Methods : constructor and searchIn
* Updated TestFile according to the updated AhoCorasick Class. Added Few more test cases
* updated - broken down constructor to relavent parts, made string final, made res local to searchIn(), doxygen-like style
* lint fix clang
* Updated Tests Files
* Added final field to Node class setters and Trie Constructor arguments, removed getTrieRoot() and some unnecessory comments, renamed [old -> new]: res -> positionByStringIndexValue, removed if condition from setupStartPoints()
* updated test file
* lint fix clang
* minor chage - 'removed a comment'
* added final fields to some arguments, class and variables, added a method initializePositionByStringIndexValue()
* updated to remove * inclusion and added the required modules only
* Implemented a new class PatternPositionRecorder to wrap up the position recording in searchIn()
* Added final fields to PatternPositionRecorder Class
* style: mark default constructor of `AhoCorasick` as `private`
* style: remoce redundant `public`
---------
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
* return a string of the words in reverse order concatenated by a single space.
Input: s = "the sky is blue"
Output: "blue is sky the"
* return a string of the words in reverse order concatenated by a single space.
Input: s = "the sky is blue"
Output: "blue is sky the"
* space reduce
* removed main method
* added test cases
* formatting fix
* formatting fix
* worked on pr reviews
* formatting fix
* private constructor added
* added test case for when string contains white space
* simplified method
* fix issue
* formatting issues fix
* fixed issue
* code refactor
* documented method
* worked on pr comments
* docs: add missing space
* tests: express as `ParameterizedTest`
---------
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Co-authored-by: vil02 <vil02@o2.pl>
* Made changes to the code to correct the Logic of Armstrong Number
* Resolved the issues
* Trying to resolve the Linter error by changing Variable name
* Changed Variable Names : trying to resolve Clang error
* rewrote as parameterized tests
* formatting issue resolved
* added test with different prime number q
* style: run `clang-format`
* tests: add missing test case
---------
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
* Added code to find Articulation Points and Bridges
* tried to solve clang-formant test
* removed new line at EOF to get lint to pass
* feature: Added Ahocorasick Algorithm
* fixed lint using clang-format
* Added QuickSort Algorithm for linked list
* removed datastructures/graphs/ArticulationPointsAndBridges and string/AhoCorasick.java from this branch
* Added datastructures/lists/SinglyLinkedList class, Replaced ListNode class
* Modified some comments
* Added tests in QuickSortLinkedListsTest.java
* removed main as added a test file to test test-cases
* test file for QuickSortLinkedLinst.java
* Added Second Min/Max program
* Clang-format-lint error resolved
* Clang-format-error 2
* Added Program to find Second Minimum/Maximum element
* Test File & few changes
* Clang-lint-error resolved
* Maven Build Error Resolved
* Clang-lint-error resolved
* Clang-lint-error resolved 2
* Changes Resolved
* Test Arguements are Streamed
* Clang-lint-error resolved
* incresed code reusability
* Added Program to find Second Min / Max
* Program to find Second Min / Max
* Program to find Second Minimum / Maximum
* Program to find Second Best Number
* style: mark `initialVal` as `final`
* style: resolve `MultipleVariableDeclarations`
Each variable declaration must be in its own statement.
---------
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
* Update Pangram.java using Java Collections
A simple separate function isPangramOrNot(String s) has been created which implements the Pangram checking of a string using Java Collection Framework approach.
* Update Pangram.java using Java Collections
* Updated some linting errors in Pangram.java
* Update src/main/java/com/thealgorithms/strings/Pangram.java
Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>
* Updated Pangram.java
Method name updated to - isPangramUsingSet(String s)
* Updated the testcases PangramTest.java
Successfully updated the testcases in this same PR branch
---------
Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>