Template Function ADS::hanoi_iterative

Function Documentation

template<class F>
void ADS::hanoi_iterative(int n, int source, int dest, int middle, F &&f)

the first hanoi-iterative(): the calls of (1) are pushed on a stack, and each pop resumes the call that was left open, moving a disk and simulating the call (2)

Pre:

n >= 1 and source, dest and middle distinct