943 Commits

Author SHA1 Message Date
0a7065df38 Add tests, remove main in IterativeBinarySearch (#5667) 2024-10-10 22:41:07 +03:00
ba3d3bf54e Add tests, remove main, improve docs in InterpolationSearch (#5666) 2024-10-10 22:36:38 +03:00
d197fc7df2 Add tests, remove main, improve docs in ExponentialSearch (#5664) 2024-10-10 22:30:37 +03:00
a4e4319126 Add tests, remove main, improve docs in FibonacciSearch (#5665) 2024-10-10 22:26:16 +03:00
ca5fbbf0a9 Add tests, remove main in BinarySearch (#5663) 2024-10-10 22:22:42 +03:00
ac2c88ca9f Add tests, add IllegalArgumentException, remove main in `WineProb… (#5662) 2024-10-10 21:19:37 +03:00
c18dbc43b5 Add tests, add IllegalArgumentException in RodCutting (#5661) 2024-10-10 21:15:35 +03:00
41f7e6aa9d Add tests, improve docs in NewManShanksPrime (#5660) 2024-10-10 21:11:43 +03:00
44b0fc9408 Implement Maximum Sum of Non-Adjacent Elements (#5544) 2024-10-10 21:07:44 +03:00
e728aa7d6f Add tests, remove main, enhance docs in MatrixChainMultiplication (#5658) 2024-10-10 20:16:04 +03:00
bd3b754eda Add EDFScheduling algorithm (#5657) 2024-10-10 19:56:44 +03:00
90d20b3a43 Add smoothing constant to IDF formula in BM25 to prevent negative scores (#5696)
Co-authored-by: prayas7102 <prayas.prithvirajpratap7@example.com>
Co-authored-by: Alex Klymenko <alexanderklmn@gmail.com>
2024-10-10 10:39:22 +03:00
d4fff30eaa feat : new bit manipulation algo Single element in an array (#5689)
* feat : new algo uniquesubseqcount

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCount.java

* feat : new bitmanipulation algo

---------

Co-authored-by: Alex Klymenko <alexanderklmn@gmail.com>
2024-10-10 10:32:02 +03:00
6535d4755d Add SwapAdjacentBits algorithm (#5634) 2024-10-09 23:02:41 +03:00
c0f35242a1 Add tests, remove print & main methods in BoundaryFill.java (#5640) 2024-10-09 22:56:51 +03:00
48c65e4c5e Add boundary traversal of binary tree (#5639) 2024-10-09 19:50:30 +00:00
f170078b8b Add Ones & Twos Complement in BitManipulation (#5604) 2024-10-09 22:45:15 +03:00
6e6028e3d0 Fix columnarTranspositionCipher and typos in Test (#5649) 2024-10-09 22:41:25 +03:00
029dd85646 Add tests, enhance docs in KadaneAlgorithm.java (#5646) 2024-10-09 22:36:00 +03:00
ce9f42081d Add tests, remove main, add negativity test in Fibonacci.java (#5645) 2024-10-09 22:20:45 +03:00
4a0e46dae6 Add tests, remove main in DiceThrow/DP.java (#5644) 2024-10-09 22:16:20 +03:00
6ddb26f48d Add tests, remove main & print methods in CoinChange.java (#5642) 2024-10-09 22:04:04 +03:00
2d34bc150f Optimised Space Complexity To O(sum) (#5651)
* Optimised Space Complexity To O(sum)

* Fixes Clang Format

* Optimised Space Complexity To Use a Single DP Array
2024-10-09 16:57:11 +03:00
0603accfd4 Add tests, remove main method, improve docs in BruteForceKnapsack (#5641) 2024-10-09 11:09:36 +03:00
4bcab89f05 Add JobSchedulingWithDeadline algorithm (#5608) 2024-10-09 06:33:39 +00:00
5c79e5de5d Add MedianOfTwoSortedArrays algorithm (#5554) 2024-10-09 08:56:08 +03:00
403649d404 Update CreateAndDetectLoop with tests (#5561) 2024-10-09 05:47:47 +00:00
b54cc21ade Add NumberAppearingOddTimes algorithm (#5633) 2024-10-08 21:42:24 +03:00
f3b2a94e74 Improve power sum algorithm (#5652)
* Update directory

* Improve PowerSum algorithm implementation and documentation

This commit enhances the PowerSum class in the backtracking package. The changes focus on improving code quality, readability, and documentation. Key improvements include:

1. Enhanced code structure and efficiency:
   - Removed class-level variables for better thread safety
   - Optimized the recursive approach to avoid unnecessary calculations
   - Simplified the overall logic for easier understanding

2. Improved readability:
   - Used more descriptive variable names (e.g., 'targetSum' instead of 'n', 'power' instead of 'x')
   - Enhanced method structure with a private recursive helper method

3. Better documentation:
   - Added comprehensive JavaDoc comments explaining the algorithm's purpose and implementation
   - Clarified the meaning of parameters, especially relating them to the original problem statement (N and X)
   - Improved inline comments for better code understanding

4. Adhered to Java best practices:
   - Improved encapsulation by making the recursive method private
   - Used Math.pow() directly instead of a custom power method

5. Maintained core functionality:
   - The algorithm still solves the same problem as before, but with improved code quality

* updated PowerSum

* Refactor PowerSum algorithm implementation and documentation

* Refactor PowerSum algorithm implementation and documentation

* Refactor code formatting and remove unnecessary line in PowerSum.java

* Refactor code formatting and add newline at end of file in .clang-format

---------

Co-authored-by: manishraj27 <manishraj27@users.noreply.github.com>
Co-authored-by: Bama Charan Chhandogi <b.c.chhandogi@gmail.com>
2024-10-08 23:59:29 +05:30
d437d581f4 Remove print & main methods (#5584) 2024-10-08 21:07:46 +03:00
ecd75c0c2e Add CrosswordSolver algorithm (#5626) 2024-10-08 21:00:02 +03:00
435532fb7b Add WordPatternMatcher algorithm (#5627) 2024-10-08 20:45:17 +03:00
d3bd2874c8 Add StackUsingTwoQueues algorithm (#5625) 2024-10-08 20:37:10 +03:00
136e0e23a4 Add SortStack algorithm (#5624) 2024-10-08 19:17:56 +03:00
0d68b655d2 feat : new dp algo added UniqueSubsequenceCount.java (#5586)
* feat : new algo uniquesubseqcount

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCount.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCountTest.java

* Update UniqueSubsequencesCount.java

---------

Co-authored-by: Alex Klymenko <alexanderklmn@gmail.com>
2024-10-08 10:55:34 +03:00
9fb8192356 Add QueueByTwoStacks algorithm (#5623) 2024-10-08 00:24:57 +03:00
bd9e324e8c Add QuadraticEquationSolver and test cases (#5619) 2024-10-07 21:17:45 +00:00
5dcf6c0f29 Enhance Trie data structure with added methods and tests (#5538) 2024-10-07 21:11:55 +00:00
6868bf8ba0 Add palindrome singly linkedlist optimised approach (#5617) 2024-10-07 21:58:17 +03:00
4a5bf39f8e Add another method to check valid parentheses in ValidParentheses.java (#5616) 2024-10-07 21:48:02 +03:00
732f7c8458 Add BM25 Inverted Index Search Algorithm (#5615) 2024-10-07 20:30:46 +03:00
676d451aa6 Add class documentation, improve comments in MazeRecursion.java (#5576) 2024-10-07 19:47:29 +03:00
62144f61af Add tests for AStar.java, enhance documentation (#5603) 2024-10-07 19:25:48 +03:00
25dc55e4ae Add Junit tests for ColumnarTranspositionCipher.java (#5599) 2024-10-07 15:11:56 +00:00
f80850b244 Add Junit tests for AffineCipher.java, improve documentation (#5598) 2024-10-07 18:08:55 +03:00
26e8ead4ed Add tests for A5Cipher.java, improve class & function documentation (#5594) 2024-10-07 14:28:01 +00:00
93cfa86a97 Add tests for A5KeyStreamGenerator.java, improve documentation (#5595) 2024-10-07 14:23:21 +00:00
cacd23a2bd Add binary addition (#5593) 2024-10-07 14:17:04 +00:00
a2457bd1ff Add tests for IIRFilter.java, fix bug in setCoeffs method (#5590) 2024-10-07 13:17:27 +00:00
fa7d357451 Add tests, enhance class & function documentation for KnightsTour (#5591) 2024-10-07 16:06:59 +03:00