【数据结构】顺序队列 Queue

这篇博客回顾了作者在软件学院学习期间对数据结构中顺序队列的基本运算算法的实现,包括实验说明、相关代码、过程记录和结果分析。提供了实验代码的下载链接,并要求转载时注明作者和出处。

08年9月入学,12年7月毕业,结束了我在软件学院愉快丰富的大学生活。此系列是对四年专业课程学习的回顾,索引参见:http://blog.csdn.net/xiaowei_cqu/article/details/7747205


顺序队列各种基本运算算法的实现


顺序队列是较为普遍的一种队列实现方式,采用环状数组来存放队列元素,并用两个变量分别指向队列的前端(front)和尾端(rear),往队列中加进或取出元素时分别改变这两个变量的计数(count)。
队列中用环状数组存储数据(合理利用空间、减少操作),通过基本的append()将元素加入队列,serve()将元素移出队列,先进入的先移出,retieve得到最先加入队列的元素。此外在继承的Extended_queue()中我增加了empty()和serve_and_retrieve()的功能。


【实验说明】

我选择的题目:课本中Programming Projects 3.3 P1
问题描述:Write a function that will read one line of input from the terminal. The input is supposed to consist of two parts separated by a colon ':'. As its results, your function should produce a single character as follows:
N   No colon on the line.
L   The left part(before the colon) is longer than the right.
R   The right part(after the colon) is longer than the left.
D   The left and right parts have the same length but are different.
S   The left and right are exactly the same.
Examples:

Use either a queue or an extended queue to keep track of the left part of the line while reading the right part.
1.分析队列要实现的基本功能以及继承的类要拓展的功能从而确定基本
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值