ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Hanoi.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*------------------------------ File Hanoi.h ------------------------------*/
3/*--------------------------------------------------------------------------*/
31/*--------------------------------------------------------------------------*/
32/*----------------------------- DEFINITIONS --------------------------------*/
33/*--------------------------------------------------------------------------*/
34
35#ifndef __ADS_Hanoi
36 #define __ADS_Hanoi
37/* self-identification: #endif constant */
38
39/*--------------------------------------------------------------------------*/
40/*------------------------------ INCLUDES ----------------------------------*/
41/*--------------------------------------------------------------------------*/
42
43#include "ADS/Contract.h"
45
46#include <tuple>
47#include <utility>
48
49/*--------------------------------------------------------------------------*/
50/*--------------------------- NAMESPACE ------------------------------------*/
51/*--------------------------------------------------------------------------*/
52
53namespace ADS
54{
55
56/*--------------------------------------------------------------------------*/
57/*------------------------------ FUNCTIONS ---------------------------------*/
58/*--------------------------------------------------------------------------*/
59
79template< class F >
80void hanoi_recursive( int n , int source , int dest , int middle , F && f );
81
82/*--------------------------------------------------------------------------*/
83
113template< class F >
114void hanoi_iterative( int n , int source , int dest , int middle , F && f );
115
116/*--------------------------------------------------------------------------*/
117
155template< class F >
156void hanoi_iterative_labels( int n , int source , int dest , int middle ,
157 F && f );
158
159/*--------------------------------------------------------------------------*/
160
161} // end( namespace ADS )
162
163/*--------------------------------------------------------------------------*/
164/*-------------------------- IMPLEMENTATION --------------------------------*/
165/*--------------------------------------------------------------------------*/
166
167#include "ADS/algorithm/impl/Hanoi.tpp"
168
169/*--------------------------------------------------------------------------*/
170
171#endif /* Hanoi.h included */
172
173/*--------------------------------------------------------------------------*/
174/*---------------------------- End File Hanoi.h ----------------------------*/
175/*--------------------------------------------------------------------------*/
The STACK of the book [see ADT.h] realized with a vector of a given capacity : the items are in the ...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
void hanoi_iterative_labels(int n, int source, int dest, int middle, F &&f)
the moves of hanoi_recursive() by the systematic rules (the second hanoi-iterative() of the book),...
void hanoi_recursive(int n, int source, int dest, int middle, F &&f)
the moves of disks from source to dest, by the recursion of the book (its hanoi-recursive())
void hanoi_iterative(int n, int source, int dest, int middle, F &&f)
the moves of hanoi_recursive() with the calls on a stack (the first hanoi-iterative() of the book): t...
Definition ADT.h:96