Combination algorithms

= an ⚙️ Algorithm that outputs all possible results (e.g. roll of dice)

Iterative algorithms

  • Roll of dice:
    • one for loop for each dice
    • Problem: doesn’t work for N dices, needs to be fixed before compiling
  • Permutations

Recursive algorithms

  • Permutations:
    • Termination check: allElementsUsed?
    • loop over available elements, pick element, append to new permutation, call function again with new list of available elements
    • Pros: no need for fixed amounts of loops
  • Labyrinth:
    • Termination check: endIsReached?
    • loop to step into each possible direction, mark field on visit
    • Pros: no helper data-structure needed