Blog Day 17: Combinatorics (Permutations, Factorial) & How to use npm
1. TIL (Today I Learned)
Permutations
Definition: Number of different possible ways we can arrange a set of elements.
Ex. You haven't watched the F1 race, but your friend spoiled who the top 3 racers are. [Lewis, Max, Kimi]
P (3) --> the total number of different ways these drivers could split the medal)
if (Lewis won the race) {
{1st: Lewis, 2nd: Max, 3rd: Kimi} || {1st: Lewis, 2nd: Kimi, 3rd: Max};
if (Lewis won the race) {
{2nd: Kimi, 3rd: Lewis} || {2nd: Lewis, 3rd: Kimi};
if (Lewis won the race) {
{2nd: Max, 3rd: Lewis} || {2nd: Lewis, 3rd: Max};
Six(permutation) unique ways the 3 drivers can split the medals.
Computation:
Intuition --> n many elements
Gold (n) Silver(n-1) Bronze(n-2) ... 1
n = different possible winners (this case it is '3')
Pₙ = n * (n-1) * (n-2) * ... * 1 = n!
Factorials
Defintion: n! --> the product of the natural numbers from 1 ton.
n! --> 1 * 2 * 3 * ... * n
3! --> 1 * 2 * 3 = 6
Important Properties for factorials
Odd Characteristics:
1. Negative numbers don't have a factorial
2. 0! === 1
Computation
n! = (n - 1)! * n
(n + 1)! = n! * (n + 1)
if (n = 6)
6! = 5 * 6
7! = 6! * 7
could be extpanded further to express
(n + k)! and (n - k)!
a. (n + k)! = n! * (n + 1) * (n + 2) * ... * (n * k)
b. (n - k)! = n! / (n - k + 1) * (n - k + 2) * ... * (n - k + k) or n
if (n = 5 && k = 2) {
a. 7! = 5! * 6 * 7
b. 3! = 5! / 4 * 5
Two factorials
if (n > k) {
n! / k! = (k + 1) * (k + 2) * ... * n
if (n = 7 && k = 4) {
7! / 4! = 5 * 6 * 7 = "1 * 2 * 3 * 4 * 5 * 6 * 7 / 1 * 2 * 3 * 4"
How to npm run submit
-
Be located in the folder you are working on and type in terminal
npm install --> this will install needed modules
-
Check for errors, type in terminal
npm run test --> this will run for test and check for errors
-
For submitting task to connected repository in Github,
npm run submit --> this will submit your assignment or project to repository
This is vital knowledge when using CLI to control your program.
2. 3 Things to be Thankful for
- I am thankful for being able to meet a good pair and finish my today's assignment on node/JS.
- I am thankful for being able to come back safely from riding my bike.
- I am thankful for having a good time today and remember my weakness and rely on God.
3. Ideas and Things to think about
- I should daily write down several topics I learned from both codestates and 365 data science because it is a good way of learning.
- What if javascript shows you the 'under the hood' part to programmers to understand deeply on how it is working behind the scenes. Anyone who makes such program, will surely become a cool entrepreneur. #litIDEA
- I felt sad in the inside even with such hustle everyday, this was because I forgot that it was all God who let me to such a happy way of living life. I should spend more time on remembering and communicating with God on how I should live my life not relying on myself. God, I know you made me feel this way. Please let me rely on you only.
Author And Source
이 문제에 관하여(Blog Day 17: Combinatorics (Permutations, Factorial) & How to use npm), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://velog.io/@inseoparkk/Blog-Day-18-Combinatorics-Permutations-Factorial-Variation-withwithout-repetition
저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
- I should daily write down several topics I learned from both codestates and 365 data science because it is a good way of learning.
- What if javascript shows you the 'under the hood' part to programmers to understand deeply on how it is working behind the scenes. Anyone who makes such program, will surely become a cool entrepreneur. #litIDEA
- I felt sad in the inside even with such hustle everyday, this was because I forgot that it was all God who let me to such a happy way of living life. I should spend more time on remembering and communicating with God on how I should live my life not relying on myself. God, I know you made me feel this way. Please let me rely on you only.
Author And Source
이 문제에 관하여(Blog Day 17: Combinatorics (Permutations, Factorial) & How to use npm), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@inseoparkk/Blog-Day-18-Combinatorics-Permutations-Factorial-Variation-withwithout-repetition저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)