Commit Graph

256 Commits

Author SHA1 Message Date
TejasSingh022
a9357102b3 Add TortoiseHareAlgo implementation with append, toString, and getMiddle methods (#6722)
* Create TortoiseHareAlgorithm.java

Implement TortoiseHareAlgo with append, getMiddle, and toString methods

- Added generic singly linked list with inner Node class
- Implemented append() to add elements
- Implemented getMiddle() using Tortoise-Hare approach
- Added toString() for readable list representation

* Create TortoiseHareAlgoTest.java

Add JUnit tests for TortoiseHareAlgo

- Verified append() and toString() output
- Tested getMiddle() for odd, even, and empty lists
- Ensured correct behavior and null handling

* Update README.md

Add TortoiseHareAlgo to linked list documentation

- Added TortoiseHareAlgo.java to file descriptions
- Described its purpose: finding middle element using Tortoise-Hare algorithm

* Rename TortoiseHareAlgorithm.java to TortoiseHareAlgo.java

Fixed build error

* Update TortoiseHareAlgoTest.java

Fixed line formatting build error

* Update TortoiseHareAlgoTest.java

Fixed line formatting build error

* Update TortoiseHareAlgo.java

Added {} after if statement instead of directly writing statement

* Update TortoiseHareAlgo.java

Fixed line formatting build error

* Update TortoiseHareAlgo.java

Added {} after if statement instead of directly writing statement

* Update TortoiseHareAlgoTest.java

Replace .* import with specific imports

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-10-14 08:53:02 +00:00
Sameer Prajapati
8726d401b7 Add Yen’s K-shortest loopless paths with tests [GRAPHS] (#6773)
* Add Yen’s K-shortest loopless paths with tests and index update

* style: fix Checkstyle in Yens algorithm and tests

* fix: resolve SpotBugs in Yens algorithm

* fix (PMD): rename short variables in the code

* (pmd): code fixes

* fix(bloomfilter): hash arrays by content to satisfy array membership tests

* style(pmd): fix EmptyControlStatement in validate() by returning early when src==dst

* style(pmd): remove unnecessary return in validate()
2025-10-13 20:22:55 +02:00
Shoyeb Ansari
bc7b656092 feat: added TwoSat solutions with Tests, also updated Directory.md (#6756)
* feat: added TwoSat solutions and Tests and also updated Directory.md

* added reference urls to the article related to the 2-SAT

* Fix generic type warnings in TwoSat.java

* maven build fix: added rawtypes in SuppressWarnings

* fixed  checkstyle error

* fix: Sorted import order

---------

Co-authored-by: a <alexanderklmn@gmail.com>
2025-10-12 22:46:12 +02:00
Priyanshu Kumar Singh
9a907c8843 [FEAT] Implement Dials Algorithm (Graph) (#6679)
[FEAT] Implement Dials Algorithm(Graph)

Co-authored-by: Priyanshu1303d <priyanshu130d@gmail.com>
2025-10-12 21:25:21 +02:00
Udaya Krishnan.M
5f8d8eeb7b Added Pretty Display method and BSTRecursiveGenericTests.java (#6621)
* added binarysearchtree

* added binarysearchtree

* updated

* updated the test values

* updated build issues

* updated

* updated

* updated

* updated

* updated

* updated

* updated

* added pretty display method

* added pretty display method

* updated pretty Display and added BSTRecursiveGenericTest.java

* updated pretty Display and added BSTRecursiveGenericTest.java

* updated pretty Display and added BSTRecursiveGenericTest.java

* updated pretty Display and added BSTRecursiveGenericTest.java

* updated pretty Display and added BSTRecursiveGenericTest.java

* added pretty display method

* updated pretty Display and added BSTRecursiveGenericTest.java

* updated pretty Display and added BSTRecursiveGenericTest.java

* updated pretty Display and added BSTRecursiveGenericTest.java

---------

Co-authored-by: Krishnan M <2318467@cognizant.com>
Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-10-08 11:55:38 +00:00
Richa Kiran
5e9d9f7337 Added Circular Doubly Linked List in the datastructures section (#6565) 2025-10-01 15:59:15 +03:00
Piotr Idzik
421ac6d74f style: include RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE (#6559) 2025-10-01 09:06:50 +02:00
Priyansh
1393f5ea6b Added-> DisjointUnion Set by Size (#6514)
* Added-> DisjointUnion Set by Size

* Add tests for DisjointSetUnionBySize

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-09-03 19:05:12 +02:00
Vicky
3961b1dab9 fix: revert ReverseStack deletion and verify linting (#6474) (#6494)
* fix: revert ReverseStack deletions and ensure lint compliance

* Fix formatting for ReverseStack and test files

* Delete ReverseStackUsingRecursion and its test as requested

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-08-22 07:41:36 +02:00
IDDQD
c9cc8f4698 Add cache with LIFO replacement policy (#6390)
* Added Random Replacement cache

* Implement cache with LIFO replacement policy

* Ran clang-format

* Make necessary variables final, replace HashMap.newHashMap(int capacity) with new HashMap<>(int capacity)

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-21 18:11:13 +02:00
Oleksandr Klymenko
dcb02c61df refactor: MajorityElement (#6380)
* refactor: MajorityElement

* refactor: fix import ordering

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-15 17:10:06 +02:00
Oleksandr Klymenko
287a708c7f refactor: Intersection (#6379)
refactor: Intersection improvement
2025-07-15 17:04:58 +02:00
Oleksandr Klymenko
ca7c77f16b refactor: improving DisjointSetUnion (#6378)
* refactor: improving DisjointSetUnion

* refactor: remove comment as it already in description

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-15 05:31:09 +00:00
KevinMwita7
c782f05ed4 Add cache with FIFO replacement policy (#6337) 2025-07-05 13:29:46 +00:00
KevinMwita7
bb36d13c93 Add RR cache (#6307) 2025-06-30 18:45:37 +00:00
Piotr Idzik
7602f1ef4c chore: suppress unchecked in selected classes (#6262) 2025-06-05 19:13:46 +03:00
Piotr Idzik
ec6f09c373 chore: suppress rawtypes in selected classes (#6261) 2025-06-05 14:23:28 +03:00
Soham Kamble
2320b46b3f Add BTree implementation (#6248) 2025-05-28 15:00:41 +03:00
Piotr Idzik
251e9e1902 refactor: introduce SinglyLinkedListNode (#6210) 2025-04-02 18:51:40 +03:00
Deniz Altunkapan
c8281e02fb Add Maximum Weighted Matching Algorithm for Trees (#6184) 2025-03-01 10:52:06 +02:00
Niklas Hoefflin
63ce6b8ca5 Refactor LWWElementSet (#6164) 2025-02-13 22:33:52 +02:00
likespro
1a2aeddec3 Add optimized version of DijkstraAlgorithm (#6088) 2024-11-19 09:09:06 +02:00
Strange Developer
df0c997e4b General performance improvement (#6078) 2024-11-01 19:52:42 +02:00
Hardik Pawar
03bb8ee66e Enhance docs, add tests in MaxHeap (#5983) 2024-10-29 22:47:33 +02:00
Hardik Pawar
857d921b07 Enhance docs, add tests in ReverseKGroup (#5999) 2024-10-29 20:22:31 +00:00
Hardik Pawar
94fb92e508 Enhance docs, add tests in GenericHeap (#5980) 2024-10-29 20:11:30 +00:00
Hardik Pawar
63d13b6f3a Enhance docs, add tests in GenericHashMapUsingArray (#5972) 2024-10-29 18:51:27 +00:00
Hardik Pawar
b31bc86192 Enhance docs, add tests in AVLTree (#6058) 2024-10-29 18:02:33 +00:00
PANKAJ PATWAL
bca8d0efe0 Add Longest Subarray With Sum Less Than or Equal to K algorithm (#6042) 2024-10-27 22:54:30 +02:00
Giulio Tantaro
a2e526b610 Add tests for NodeStack (#6009) 2024-10-27 22:39:56 +02:00
Hardik Pawar
d4a13fc8b5 Enhance docs, remove main, add tests in `SearchSinglyLink… (#6012) 2024-10-26 22:13:57 +03:00
Ayush Majumder
84522baa92 Update README.md and add some description (#5886) 2024-10-26 18:55:41 +00:00
Hardik Pawar
62c9309a31 Enhance docs, remove main, add tests in PrimMST (#5969) 2024-10-26 18:10:19 +00:00
Hardik Pawar
cfa35a4fd9 Add tests, fix removeEdge bug in MatrixGraphs (#5968) 2024-10-26 18:00:02 +00:00
Hardik Pawar
c6571382d9 Enhance docs, add tests in TarjansAlgorithm (#5970) 2024-10-26 17:51:13 +00:00
Hardik Pawar
474e0dea02 Enhance docs, add more tests in WelshPowell (#5971) 2024-10-26 16:57:43 +00:00
Hardik Pawar
a78b15dc24 Enhance docs, add tests in MinHeap (#5985) 2024-10-26 16:53:32 +00:00
Hardik Pawar
bc6ea1ec87 Enhance docs, fix & add tests in `GenericHashMapUsingArrayL… (#5973) 2024-10-26 16:45:16 +00:00
Hardik Pawar
f5bc2c807d Add more tests in HashMap (#5974) 2024-10-26 16:29:21 +00:00
Hardik Pawar
cd40dfbb41 Enhance docs, add tests in HashMapCuckooHashing (#5975) 2024-10-26 16:17:58 +00:00
Hardik Pawar
84cd883e95 Enhance docs, add tests in Intersection (#5976) 2024-10-26 16:08:52 +00:00
Hardik Pawar
26f114cb60 Enhance docs, add tests in LinearProbingHashMap (#5977) 2024-10-26 16:05:31 +00:00
Hardik Pawar
4ea3098595 Enhance docs, add tests in MajorityElement (#5978) 2024-10-26 16:02:07 +00:00
Hardik Pawar
7e87e5840e Enhance docs, add tests in FibonacciHeap (#5979) 2024-10-26 15:44:30 +00:00
Hardik Pawar
8a18d451d6 Enhance docs, add tests in HeapElement (#5981) 2024-10-26 15:39:28 +00:00
Hardik Pawar
20239f20f1 Enhance docs, add tests in LeftistHeap (#5982) 2024-10-26 18:28:55 +03:00
Hardik Pawar
9e1dd86a08 Add MergeKSortedArrays algorithm (#5838) 2024-10-26 12:19:37 +00:00
Hardik Pawar
04e421b837 Add SlidingWindowMaximum algorithm (#5839) 2024-10-26 12:12:55 +00:00
Hardik Pawar
5d428d08a2 Add MedianFinder algorithm (#5837) 2024-10-26 09:35:23 +00:00
Hardik Pawar
d572997894 Add KthElementFinder algorithm (#5836) 2024-10-26 09:30:42 +00:00