unique函数
unique函数的作用,就是提取非重复值。比如我们要提取数组中的非重复值,公式如下:unique(a,a+n)
头文件:#include <algorithm>
#include<stdio.h>
#include<string.h>
#include<algorithm>
int main(){
int i,a[8]={2,2,2,4,4,6,7,8};
unique(a,a+8);
for(i=0;i<strlen(a);i++)
printf("%d",a[i]);
return 0;
}
栈和队列
栈和队列的共同特点是允许在端点处插入和删除元素。
栈是限制在表的一端进行插入和删除运算的线性表,又称后进先出,简称LIFO表。
队列也是一种运算受限的线性表,只允许在标的一端进行插入,而在另一端进行删除,又称先进先出,简称FIFO表。
栈
Insert(L,n+1,x)
Delete(L,n)
而栈只允许在表尾一端进行插入和删除
队列
Insert(L,n+1,x)
Delete(L,1)
队列只允许在表尾一端进行插入,在表头一端进行删除