choice
M?n 

所属分类:数据结构
开发工具:Visual C++
文件大小:168KB
下载次数:4
上传日期:2012-11-06 16:40:28
上 传 者werk
说明:  实验目的 熟悉线性表的基本运算在顺序存储结构和链式存储结构上的实现,其中重点熟悉链表的各种操作。 时间要求:4学时 问题描述: 约瑟夫(Joseph)问题的一种描述是:编号为1,2,3,…,n的n个人按顺时针方向围坐一圈,每人持有一个密码〈正整数〉,一开始任选一个正整数作为报数上限值m,从第一个人开始按顺时针方向自1开始顺序报数,报到m时停止报数,报m的人出列,将他的密码作为新的m值,从他在顺时针方向上的下一个人开始重新从1报数,如此下去,直至所有人全部出列为止。试设计一个程序求出出列顺序。 基本要求: 利用单向循环链表存储结构模拟此过程,按照出列的顺序打印出各人的编号。 实现提示: 程序运行后首先要求用户指定初始报数上限值,然后读取各人的密码(小于30)。 选作内容: 在顺序存储结构上实现上述问题的操作。 Input 输入包括两行,第一行包括报数上限值m和人数n,第二行为n个人的密码,所有数据之间由空格分隔。 Output 输出一行,共n个整数,表示各编号人的出列顺序。各数之间由空格分隔。 Sample Input 20 7 3 1 7 2 4 8 4 Sample Output 6 1 4 7 2 3 5
(Purpose of the experiment Familiar linear form of basic operations on a sequential storage structure and chain storage structure to achieve the various operations, which focus on familiar linked list. Time requirements: 4 hours Description of the problem: Joseph (Joseph) a description of the problem: the number 1, 2, 3, ..., n n people sit in a circle in a clockwise direction, the person holding a password <positive integer> beginning choose one positive integer as the upper limit of m countin clockwise direction starting from the first person since the start sequence reported report m stop reported that the number of reported m the person out of the line, his password as the new value of m , starting from the next person in a clockwise direction from 1 reported that the number of re-it goes on, until everyone is all out of the line so far. Try to design a program that determined the order of columns. Basic requirements: The use of one-way circular linked list storage struc)

文件列表:
实验一 线性表实验\实验一.dsp (3403, 2012-11-06)
实验一 线性表实验\Debug\vc60.idb (33792, 2012-11-06)
实验一 线性表实验\Debug\vc60.pdb (45056, 2012-11-06)
实验一 线性表实验\Debug\实验一.pch (222368, 2012-11-06)
实验一 线性表实验\Debug\实验一.obj (5054, 2012-11-06)
实验一 线性表实验\Debug\实验一.ilk (182104, 2012-11-06)
实验一 线性表实验\Debug\实验一.exe (184383, 2012-11-06)
实验一 线性表实验\Debug\实验一.pdb (361472, 2012-11-06)
实验一 线性表实验\实验一.ncb (33792, 2012-11-06)
实验一 线性表实验\实验一.plg (736, 2012-11-06)
实验一 线性表实验\实验一.opt (48640, 2012-11-06)
实验一 线性表实验\实验一.dsw (520, 2012-11-06)
实验一 线性表实验\choice.cpp (2401, 2012-10-20)
实验一 线性表实验\Debug (0, 2012-11-06)
实验一 线性表实验 (0, 2012-10-15)

近期下载者

相关文件


收藏者