Skip to content

Conversation

Ayush41
Copy link

@Ayush41 Ayush41 commented Oct 11, 2025

Description

This PR adds an implementation of the Factorial algorithm using recursion under the com.thealgorithms.recursion package.

✅ Summary:

  • Added Factorial.java to demonstrate factorial calculation using recursion.
  • Added corresponding test file FactorialTest.java for unit testing.
  • Follows the repository’s structure, documentation style, and naming conventions.
  • Includes exception handling for negative inputs.

🧠 Algorithm Overview:

The factorial of a non-negative integer n is defined as:
Time Complexity: O(n)
Space Complexity: O(n) (recursive stack)

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.79%. Comparing base (f0fb971) to head (2fb1dcb).

Files with missing lines Patch % Lines
...in/java/com/thealgorithms/recursion/Factorial.java 71.42% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6736      +/-   ##
============================================
- Coverage     76.80%   76.79%   -0.02%     
- Complexity     6047     6051       +4     
============================================
  Files           719      720       +1     
  Lines         20342    20349       +7     
  Branches       3940     3941       +1     
============================================
+ Hits          15624    15627       +3     
- Misses         4127     4130       +3     
- Partials        591      592       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Ayush41 Ayush41 closed this Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants