ADS
Algorithms and Data Structures
Toggle main menu visibility
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
"
44
#include "
ADS/stack/ArrayStack.h
"
45
46
#include <tuple>
47
#include <utility>
48
49
/*--------------------------------------------------------------------------*/
50
/*--------------------------- NAMESPACE ------------------------------------*/
51
/*--------------------------------------------------------------------------*/
52
53
namespace
ADS
54
{
55
56
/*--------------------------------------------------------------------------*/
57
/*------------------------------ FUNCTIONS ---------------------------------*/
58
/*--------------------------------------------------------------------------*/
59
79
template
<
class
F >
80
void
hanoi_recursive
(
int
n ,
int
source ,
int
dest ,
int
middle , F && f );
81
82
/*--------------------------------------------------------------------------*/
83
113
template
<
class
F >
114
void
hanoi_iterative
(
int
n ,
int
source ,
int
dest ,
int
middle , F && f );
115
116
/*--------------------------------------------------------------------------*/
117
155
template
<
class
F >
156
void
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
/*--------------------------------------------------------------------------*/
ArrayStack.h
The STACK of the book [see ADT.h] realized with a vector of a given capacity : the items are in the ...
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::hanoi_iterative_labels
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),...
ADS::hanoi_recursive
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())
ADS::hanoi_iterative
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...
ADS
Definition
ADT.h:96
ADS
algorithm
Hanoi.h
Generated by
1.17.0