文件名称:queue
- 所属分类:
- 数据结构常用算法
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 5kb
- 下载次数:
- 0次
- 提 供 者:
- mai****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
组队列算法:
设置队列指针a和b,a和b都为0
建立n个数组记录元素的分组情况
初始化,i=0,表示当前有多少个队列已经有元素
读入1个命令
如果是删除命令,从第a个队列开始搜索,找到第1个元素出队
如果删除元素后队列变空,a++
如果是结束命令,输出所有队列的元素,注意队列为空则不要输出
如果是插入命令,首先检查a到b中各个队列是否有同组元素
如果在第k个队列发现同组元素,则进入第k队列
如果无发现,则插入第b个队列,b++
-Group queue algorithm: the establishment of a queue array contains n queues, n = 1000, set the queue is empty for all queue pointers a and b, a and b are 0 records to establish an array of n elements of the group of initialization, i = 0, indicating the current number of queue has elements read a command if it is delete command, from the first a one queue to start the search, to find the first element of a team if you delete elements after the queue is empty, a++ if it is the end of the command , output all the elements of the queue, the queue is empty, do not pay attention to the output if it is inserted command, first check from a to b in each queue have the same group element if the queue is found in the k-th element of the same group, then enter the queue if no k-th found, then insert the first b queues, b++
设置队列指针a和b,a和b都为0
建立n个数组记录元素的分组情况
初始化,i=0,表示当前有多少个队列已经有元素
读入1个命令
如果是删除命令,从第a个队列开始搜索,找到第1个元素出队
如果删除元素后队列变空,a++
如果是结束命令,输出所有队列的元素,注意队列为空则不要输出
如果是插入命令,首先检查a到b中各个队列是否有同组元素
如果在第k个队列发现同组元素,则进入第k队列
如果无发现,则插入第b个队列,b++
-Group queue algorithm: the establishment of a queue array contains n queues, n = 1000, set the queue is empty for all queue pointers a and b, a and b are 0 records to establish an array of n elements of the group of initialization, i = 0, indicating the current number of queue has elements read a command if it is delete command, from the first a one queue to start the search, to find the first element of a team if you delete elements after the queue is empty, a++ if it is the end of the command , output all the elements of the queue, the queue is empty, do not pay attention to the output if it is inserted command, first check from a to b in each queue have the same group element if the queue is found in the k-th element of the same group, then enter the queue if no k-th found, then insert the first b queues, b++
(系统自动生成,下载前可以参看下载内容)
下载文件列表
queue\queue.cpp
.....\queue.dsp
.....\queue.dsw
.....\queue.ncb
.....\queue.opt
.....\说明文档.txt
.....\Debug
queue
.....\queue.dsp
.....\queue.dsw
.....\queue.ncb
.....\queue.opt
.....\说明文档.txt
.....\Debug
queue