combinatorics
Combinations
Number of ways to select
-
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!
-
Number of ways to arrange the players in 3 slots?
- [P1 P2 P3 P4] 4 3 2 1 = 24 ways
-
Number of ways to select 0 item from c item (nC0)
- 1
-
Select N item from N items (nCn)
- 1
-
nCn-r = N!/(N-R)! * (N-(N-r))! = N!/(N-r)! * (r!)
-
Given N distinct, select r distincet elements (select or not select nth element) nCr = n-1Cr-1 + n-1Cr
-
Pascal's triangle generate
time complexity - N^2 space complexity - 1 if return N^2 if print
-
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