Combinations vs permutations
easy 15 minPermutations count arrangements where order matters (AB is not BA); combinations count selections where it does not ({A, B} is {B, A}).
Where it shows up
The same pattern appears across everyday software.
Lotteries and odds
A 6-from-49 lottery ticket is a combination: the order the balls are drawn does not matter, so there are C(49, 6) = 13,983,816 possible tickets and one of them wins.
Database join ordering
A query that joins n tables can be executed in n! orders, and the cost of each can differ by orders of magnitude. Optimisers use dynamic programming and heuristics because listing 3,628,800 orders for 10 tables is too slow.
Password strength
Each extra character multiplies the number of possible passwords by the size of the alphabet. An 8-character password over 62 letters and digits has 62^8, about 218 trillion, options; 12 characters has about 3 × 10^21.
A/B testing and feature selection
Testing every combination of 10 features chosen from 100 means C(100, 10), about 17 trillion, subsets. Machine learning uses greedy forward or backward selection and regularisation instead of exhaustive search.
Scheduling and routing
Delivery routes, round-robin tournaments and exam timetables are arrangements of stops, teams or slots. The travelling salesman problem has (n - 1)! / 2 distinct tours, which is why it is solved with DP or approximation rather than brute force.