Sign in
ara-mdk
/
platform
/
ndk
/
132cbd6ba1a0653beb4b85e11c5cbebe8a4e9c48
/
.
/
tests
/
build
/
test-gnustl-chrono
/
jni
/
hanoi.c
blob: 31837515e4d8eca55ec3324cd5616cb1f909c37a [
file
] [
log
] [
blame
]
#include
"hanoi.h"
void
hanoi
(
int
from
,
int
to
,
int
mid
,
int
n
,
void
(*
callback
)(
int
,
int
))
{
if
(
n
==
1
)
{
callback
(
from
,
to
);
}
else
{
hanoi
(
from
,
mid
,
to
,
n
-
1
,
callback
);
callback
(
from
,
to
);
hanoi
(
mid
,
to
,
from
,
n
-
1
,
callback
);
}
}