Skip to main content

combinatorics

Combinations

Number of ways to select

  1. In how many ways can we select 3 players from a pool of 4 players?

    • [P1 P2 P3 P4] Ans- P1 P2 P3 P1 P3 P4 P1 P2 P4 P2 P3 P4

    nPr = nCr * r! N!/(N!*(N-R)!) = nCr * r!

  2. Number of ways to arrange the players in 3 slots?

    • [P1 P2 P3 P4] 4 3 2 1 = 24 ways
  3. Number of ways to select 0 item from c item (nC0)

    • 1
  4. Select N item from N items (nCn)

    • 1
  5. nCn-r = N!/(N-R)! * (N-(N-r))! = N!/(N-r)! * (r!)

  6. Given N distinct, select r distincet elements (select or not select nth element) nCr = n-1Cr-1 + n-1Cr

  7. Pascal's triangle generate alt text

    time complexity - N^2 space complexity - 1 if return N^2 if print

  8. Find Nth column title 1 2 3 4 5 ...........26 27 28 ..... 50 51 52 A B C D E ...........Z AA AB .......AX AY AZ