Format code with prettier (#3375)

This commit is contained in:
acbin
2022-10-03 17:23:00 +08:00
committed by GitHub
parent 32b9b11ed5
commit e96f567bfc
464 changed files with 11483 additions and 6189 deletions

View File

@ -5,9 +5,9 @@ package com.thealgorithms.maths;
* Binomial Cofficients: A binomial cofficient C(n,k) gives number ways
* in which k objects can be chosen from n objects.
* Wikipedia: https://en.wikipedia.org/wiki/Binomial_coefficient
*
*
* Author: Akshay Dubey (https://github.com/itsAkshayDubey)
*
*
* */
public class BinomialCoefficient {
@ -20,8 +20,10 @@ public class BinomialCoefficient {
* @return number of ways in which no_of_objects objects can be chosen from total_objects objects
*/
public static int binomialCoefficient(int totalObjects, int numberOfObjects) {
public static int binomialCoefficient(
int totalObjects,
int numberOfObjects
) {
// Base Case
if (numberOfObjects > totalObjects) {
return 0;
@ -33,7 +35,9 @@ public class BinomialCoefficient {
}
// Recursive Call
return binomialCoefficient(totalObjects - 1, numberOfObjects - 1)
+ binomialCoefficient(totalObjects - 1, numberOfObjects);
return (
binomialCoefficient(totalObjects - 1, numberOfObjects - 1) +
binomialCoefficient(totalObjects - 1, numberOfObjects)
);
}
}