This is the brute force algorithm. Exponential time guaranteed. Unless the question has the magic word "all", do not use exhaustive search.
Combinations
Order doesn't matter. Same element cannot be used twice
Permutations
Order does matter. Same element cannot be used twice
Wikipedia Depth-first Searcharrow-up-right
Wikipedia Combinationarrow-up-right
Wikipedia Permutationarrow-up-right
Last updated 6 years ago