So this blog wouldnt contain any code, just pure math that I think might help with programming + I wouild recmmend knowing math because know good math allow you to save A LOT of code. + This is my blog to compile what I've learned, I hope that when you read this you would learn something.
- Theory:
- definition n! = n * (n-1) * (n-2) * .... * 1
- amount of ways to permute a sequence of n numbers is n!, this can be proven by fixing the first element which we can take n element as the first element, then it would be a sub problem, permutating n-1 elemnts, so we get n! = (n-1)! * n -> we have proven for all n
- amount of ways to permute k elements out of n elements is (n!/ (n — k)!), this is simple because we can use the same proof as n!, but we have and ending at n — k.
- amount of ways to of picking k elements out of n elements where order doesen't matter is (n! / (n-k)!k!), this is simple, we continue from permutating k elements out of n elements, and then because the k element could be permutate in k! (first proof), we can just divide by k! so we fix the order without overcounting the permutations.
- The amount of ways to permute a sequence of duplicate elemnts is (n! / (c1! * c2! * c3!...)) where c stand for each character amount, why this work, for each subset of characters, we could permute then c1! ways, because its duplicate, all permutation the same so we want to divide by c1! so they dont count duplicates.
Problems: +




