A stack may be regarded as a railway switching network like the one in the figure. Cars numbered 1, 2, …, n are on the line at the left, and it is desired to rearrange (permute) the cars as they leave on the right-hand track. A car that is on the spur (stack) can be left there or sent on its way down the right track, but it can never be sent back to the incoming track. Please write a program to list all the possible permutation.
Input:输入一任意数字 N 代表序列长度 Output:所有顺序组合以及顺序组合总数 序列的输出方向不拘 Ex Input:3 Output:先输出者在右边 321 231 312 132 123 先输出者在左边 123 132 or 213 231 321
程式运行: 60% Recursive Programing: 25% 程式可读性: 10% 说明档: 5%
程式语言不限 请附上说明档,说明程式码如何运作 Due Date: 4/10
请把程式及说明档压缩后上传至下列FTP上 档名为[语言]学号(Ex. [C]E2497xxxx),传到hw2资料夹.
FTP:Address: 140.116.72.171 Username: data Password: structure Port: 21
课程网页 http://dcmc.ee.ncku.edu.tw/ 助教信箱 cgw99m@dcmc.ee.ncku.edu.tw