当前位置:网站首页>Divide and rule classic Hanoi
Divide and rule classic Hanoi
2022-06-28 09:07:00 【C_ x_ three hundred and thirty】
package com.Cx_330.Algorithm.Hanoi;
public class HanoiDemo {
public static void main(String[] args) {
char first='A';
char second='B';
char third='C';
playHanoi(first,second,third,7);
}
private static void playHanoi(char destination, char mid, char resource, int i) {
if(i==1){
System.out.println(" The first 1 A plate from "+destination+" Move to "+resource);
}else {
playHanoi(destination,resource,mid,i-1);
System.out.println(" The first "+i+" A plate from "+destination+" Move to "+resource);
playHanoi(mid,destination,resource,i-1);
}
}
}
边栏推荐
- Large current and frequency range that can be measured by Rogowski coil
- Data modeling based on wide table
- 買賣股票費用計算
- Android studio interview preparation
- Chrome devtools
- Common test method used by testers --- orthogonal method
- 1. Kimball dimension modeling of data warehouse: what is a fact table?
- Analysis of prepaid power purchase device
- break database---mysql
- I want to register my stock account online. How do I do it? Is online account opening safe?
猜你喜欢

Redis5.0 slot migration, free play (single machine migration cluster)

104. maximum depth of binary tree

Comment supprimer le crosstalk SiC MOSFET?

Apiccloud, together with 360 Tianyu, helps enterprises keep the "first pass" of APP security
![[cloud native | kubernetes] in depth understanding of pod (VI)](/img/ae/f16f5c090251ab603b88ddadff7eb3.png)
[cloud native | kubernetes] in depth understanding of pod (VI)

Implementation of code scanning login

使用transform:scale之后导致页面鼠标悬浮事件消失

What are the advantages of a differential probe over a conventional probe

1. Kimball dimension modeling of data warehouse: what is a fact table?

Characteristics and prevention of electrical fire
随机推荐
Basic content learning of software testing (I)
Implementation of single sign on
Rich text - Test Case
What are the advantages of a differential probe over a conventional probe
Ffmpeg streaming fails to update header with correct duration
Goldbach`s Conjecture
new URL(“www.jjj.com“)
【大案例】学成在线网站
Quickly understand JVM structure and working principle
Potential safety hazards in elderly care facilities
Apache Doris becomes the top project of Apache
Basic operation of PMP from applying for the exam to obtaining the certificate, a must see for understanding PMP
Stock suspension
Music website design based on harmonyos (portal page)
Copy & Deepcopy
Key points of building fire protection design
The Cassandra cluster reinstalls and starts from the node. An error is reported. There is an existing solution
分而治之之经典Hanoi
redis5.0的槽点迁移,随意玩(单机迁移集群)
APICloud携手三六零天御,助力企业守好App安全“第一关”