Permutations & combinations
Në shqip: Permutacionet dhe kombinimet
ShpjegimiSQ
Permutacionet janë të gjitha renditjet e mundshme (ABC, ACB, BAC…), kombinimet janë grupet pa marrë parasysh renditjen. Gjenerohen me backtracking dhe rriten shumë shpejt (n!).
EnglishEN
Permutations are every possible ordering (ABC, ACB, BAC…), combinations are groups regardless of order. They're generated with backtracking and grow very fast (n!).
Si ta mendosh
Si të gjitha mënyrat për të ulur 3 shokë në 3 karrige.
Lexoje në anglisht
Like all the ways to seat 3 friends on 3 chairs.
Shembull kodipython
from itertools import permutations, combinations
print(list(permutations("ABC", 2)))
print(list(combinations("ABCD", 2)))