Blog Day 17: Combinatorics (Permutations, Factorial) & How to use npm

Inseo Park·2021년 7월 24일
0

Path to Data Scientist

목록 보기
17/58
post-thumbnail

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

  1. Be located in the folder you are working on and type in terminal

    npm install --> this will install needed modules
  2. Check for errors, type in terminal

    npm run test --> this will run for test and check for errors
  3. 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

  1. I am thankful for being able to meet a good pair and finish my today's assignment on node/JS.
  2. I am thankful for being able to come back safely from riding my bike.
  3. I am thankful for having a good time today and remember my weakness and rely on God.

3. Ideas and Things to think about

  1. I should daily write down several topics I learned from both codestates and 365 data science because it is a good way of learning.
  2. 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
  3. 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.
profile
my journey to become a data scientist.

0개의 댓글