当前位置:网站首页>Yyds dry goods inventory C language recursive implementation of Hanoi Tower
Yyds dry goods inventory C language recursive implementation of Hanoi Tower
2022-07-06 21:51:00 【ZS_ Jie】
The tower of Hanoi problem refers to : There are three needles on one board A、B、C.A The needle is covered with a needle 64 A disc of different sizes , According to the big one 、 The small ones are arranged in the order of , I want to put this 64 A disk from A The needle moves to C On the needle , Only one disc can be moved at a time , The movement process can be done with the help of B The needle . But at any time , Any disc on the needle must keep the big one down , Small in . Enter the number of disks to be moved from the keyboard , Give the process of moving .
Ideas :
- n==1 when , When only one disc is moved , Direct the disc from A The needle moves to C The needle
- n>1 when ,
hold (n-1) A disk from A The needle moves to B The needle ( With the help of C The needle );
A The last disc on the needle moves to C The needle ;
B On the needle (n-1) A disk moves to C The needle ( With the help of A The needle ).
Every time I do it , One less moving disc , Gradually decreasing , Finally, when n by 1 when , Complete the entire movement
Algorithm implementation
example
When there is 3 When you have a plate 
边栏推荐
- JS get array subscript through array content
- 一行代码可以做些什么?
- Aggregate function with key in spark
- Dialogue with Jia Yangqing, vice president of Alibaba: pursuing a big model is not a bad thing
- Redistemplate common collection instructions opsforhash (IV)
- Michael smashed the minority milk sign
- guava:创建immutableXxx对象的3种方式
- 1D convolution detail
- Proxy and reverse proxy
- PostgreSQL 修改数据库用户的密码
猜你喜欢
![[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs](/img/66/4d94ae24e99599891636013ed734c5.png)
[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs

Microsoft technology empowerment position - February course Preview

麦趣尔砸了小众奶招牌
Why does MySQL index fail? When do I use indexes?

Efficiency tool +wps check box shows the solution to the sun problem

华为在多个行业同时出击,吓人的技术让欧美企业瑟瑟发抖
![[redis design and implementation] part I: summary of redis data structure and objects](/img/2e/b147aa1e23757519a5d049c88113fe.png)
[redis design and implementation] part I: summary of redis data structure and objects

C# 如何在dataGridView里设置两个列comboboxcolumn绑定级联事件的一个二级联动效果

ViT论文详解

PostgreSQL modifies the password of the database user
随机推荐
十一、服务介绍及端口
Run the deep network on PI and Jetson nano, and the program is killed
MySQL - transaction details
Persistence / caching of RDD in spark
Sdl2 source analysis 7: performance (sdl_renderpresent())
Dialogue with Jia Yangqing, vice president of Alibaba: pursuing a big model is not a bad thing
14 years Bachelor degree, transferred to software testing, salary 13.5k
The underlying implementation of string
WEB功能测试说明
C# 如何在dataGridView里设置两个列comboboxcolumn绑定级联事件的一个二级联动效果
Leetcode topic [array] -118 Yang Hui triangle
Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
50个常用的Numpy函数解释,参数和使用示例
What is the RDD operator in spark
记一次清理挖矿病毒的过程
document. Usage of write () - write text - modify style and position control
Numpy download and installation
Web开发小妙招:巧用ThreadLocal规避层层传值
Why is the cluster mode of spark on Yan better than the client mode
Aggregate function with key in spark