当前位置:网站首页>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
边栏推荐
- Run the deep network on PI and Jetson nano, and the program is killed
- FZU 1686 龙之谜 重复覆盖
- Efficiency tool +wps check box shows the solution to the sun problem
- Michael smashed the minority milk sign
- Reinforcement learning - learning notes 5 | alphago
- 用aardio写一个旋转验证码标注小工具
- [Chongqing Guangdong education] Information Literacy of Sichuan Normal University: a new engine for efficiency improvement and lifelong learning reference materials
- JS operation DOM element (I) -- six ways to obtain DOM nodes
- 跨分片方案 总结
- 关于char[]数组通过scanf赋值使用上的一些问题。。
猜你喜欢
MPLS experiment
C how to set two columns comboboxcolumn in DataGridView to bind a secondary linkage effect of cascading events
1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析
Broadcast variables and accumulators in spark
Internet News: Geely officially acquired Meizu; Intensive insulin purchase was fully implemented in 31 provinces
Five wars of Chinese Baijiu
It's not my boast. You haven't used this fairy idea plug-in!
[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
袁小林:安全不只是标准,更是沃尔沃不变的信仰和追求
[Digital IC manual tearing code] Verilog automatic beverage machine | topic | principle | design | simulation
随机推荐
中国白酒的5场大战
数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
Absolute primes (C language)
Broadcast variables and accumulators in spark
The difference between break and continue in the for loop -- break completely end the loop & continue terminate this loop
Quick access to video links at station B
一行代码可以做些什么?
Replace Internet TV set-top box application through digital TV and broadband network
十一、服务介绍及端口
High precision face recognition based on insightface, which can directly benchmark hongruan
【力扣刷题】一维动态规划记录(53零钱兑换、300最长递增子序列、53最大子数组和)
[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
麦趣尔砸了小众奶招牌
[Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)
华为在多个行业同时出击,吓人的技术让欧美企业瑟瑟发抖
50个常用的Numpy函数解释,参数和使用示例
快讯:飞书玩家大会线上举行;微信支付推出“教培服务工具箱”
R3live notes: image processing section
SDL2来源分析7:演出(SDL_RenderPresent())
Proxy and reverse proxy