一.队列的定义及其运算1、定义 队列(Queue)是只允许在一端进行插入,而在另一端进行删除的运算受限的线性表。 (1)允许删除的一端称为队头(Front)。 (2)允许插入的一端称为队尾(Rear)。 (3)当队列中没有元素时称为空队列。 (4)队列亦称作先进先出(First In Firs...
分类:
其他好文 时间:
2015-02-09 12:32:14
阅读次数:
124
Commando War“Waiting for orders we held in the wood, word from the front never cameBy evening the sound of the gunfire was mi...
分类:
其他好文 时间:
2015-02-04 21:37:20
阅读次数:
154
1 template 2 class SqQueue 3 { 4 protected: 5 int count; 6 int front,rear; 7 int maxSize; 8 ElemType *elem; 9 public: 10 ...
分类:
其他好文 时间:
2015-02-02 17:53:10
阅读次数:
184
关于Node.h,请参考LinkStack 1 #include"Node.h" 2 template 3 class LinkQueue 4 { 5 protected: 6 Node *front,*rear; 7 int count; 8 public: 9 ...
分类:
其他好文 时间:
2015-02-02 17:46:42
阅读次数:
214
//1.队列顺序结构的定义
#define MAXQSIZE 100
typedef struct
{
QElemType base[MAXQSIZE];//静态数组
int front;//队列头指针
int rear;//队列尾指针
}SqQueue;
//解决队列的假溢出方法
//1.将循序列队臆造为一个环状空间。尾指针指向头指针
//2.在对满的情况下,rear指针和front...
分类:
其他好文 时间:
2015-01-31 19:27:25
阅读次数:
319
算法假如有一组数为3,12,24,36,55,68,75,88要查给定的值24.可设三个变量front,mid,end分别指向数据的上界,中间和下界,mid=(front+end)/2. 1.开始令front=0(指向3),end=7(指向88),则mid=3(指向36)。因为mid>x,故应在前....
分类:
编程语言 时间:
2015-01-30 15:20:38
阅读次数:
114
原题链接:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/
很简单的题,维持一个front标志和prev维持之前的值,边扫边比较。
class Solution {
public:
int removeDuplicates(int A[], int n) {
if ...
分类:
其他好文 时间:
2015-01-27 18:34:54
阅读次数:
190
原题链接:https://oj.leetcode.com/problems/remove-element/
很简单一道题。。。
class Solution {
public:
int removeElement(int A[], int n, int elem) {
int front = 0;
int idx = 0;
whi...
分类:
其他好文 时间:
2015-01-27 18:34:17
阅读次数:
170
具体Intent用法如下://默认的跳转类型,会重新创建一个新的Activityintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);//如果activity在task存在,拿到最顶端,不会启动新的Activityintent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);//如果activity在task存在,将Activit..
分类:
其他好文 时间:
2015-01-22 15:44:17
阅读次数:
231
题意 模拟打印队列 队列中有优先级大于队首的元素 队首元素就排到队尾 否则队首元素出队 输出开始在p位置的元素是第几个出队的
直接模拟这个过程就行了
#include
using namespace std;
const int N = 205;
int q[N];
int main()
{
int cas, n, p, cnt, front, rear, i;
...
分类:
其他好文 时间:
2015-01-22 15:38:19
阅读次数:
232