Skip to content

Commit

Permalink
Time Complexity: Update the definition of a factorial (#28914)
Browse files Browse the repository at this point in the history
* Update the definition of a factorial

* Update the definition of a factorial
  • Loading branch information
Maddily authored Oct 4, 2024
1 parent 4f06250 commit b4ed3bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion javascript/computer_science/time_complexity.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ You want to avoid this if at all possible, otherwise you won't be processing muc

#### O(N!) - Factorial complexity

A factorial is the product of the sequence of *n* integers. The factorial of 4(4!) is 4 \* 3 \* 2 \* 1.
The factorial of a number is the product of all numbers between 1 and that number. The factorial of 4(4!) is 4 \* 3 \* 2 \* 1.

You will come across Factorial Complexity if you ever need to calculate permutations or combinations. If you have an array and have to work out all the combinations you can make from the array, that is a Factorial complexity. It's manageable for a small number of items, but the leap with each new item in a dataset can be huge.

Expand Down
2 changes: 1 addition & 1 deletion ruby/computer_science/time_complexity.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ You want to avoid this if at all possible, otherwise you won't be processing muc

#### O(N!) - factorial complexity

A factorial is the product of the sequence of *n* integers. For example, the factorial of 4 (written as 4!) is 4 \* 3 \* 2 \* 1.
The factorial of a number is the product of all numbers between 1 and that number. For example, the factorial of 4 (written as 4!) is 4 \* 3 \* 2 \* 1.

You will come across Factorial Complexity if you ever need to calculate permutations or combinations. If you have an array and have to work out all the combinations you can make from the array, that is a Factorial complexity. It's manageable for a small number of items, but the leap with each new item in a dataset can be huge.

Expand Down

0 comments on commit b4ed3bc

Please sign in to comment.