文件名称:A0_001 链表编程
介绍说明--下载内容来自于网络,使用问题请自行百度
N只猴子要选大王,所有猴子按1,2,3...M报数,凡报到M的退出圈外,如此循环,直到圈内只剩一只,就是大王了.
分析:建立一个环形链表,每个猴子就是链表中的一个结点,那么猴子出圈就是对环形链表中的结点的删除,只到最后剩下的一个结点为止.-N monkeys to elect king, all the monkeys reported by a number 1,2,3 ... M, where M to report the withdrawal of outsiders, and so on, until only one circle is the king of. Analysis: the establishment of a ring linked list, each monkey is a list of a node, then the monkey out of the circle is a right circular list node removal, only to the last remaining until a node.
分析:建立一个环形链表,每个猴子就是链表中的一个结点,那么猴子出圈就是对环形链表中的结点的删除,只到最后剩下的一个结点为止.-N monkeys to elect king, all the monkeys reported by a number 1,2,3 ... M, where M to report the withdrawal of outsiders, and so on, until only one circle is the king of. Analysis: the establishment of a ring linked list, each monkey is a list of a node, then the monkey out of the circle is a right circular list node removal, only to the last remaining until a node.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
A0_001.PAS
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.