Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empt...
分类:
其他好文 时间:
2015-08-13 22:28:14
阅读次数:
99
和栈类似,队列queue也是表。然而,使用队列时插入在一端进行而删除在另一端进行。
队列的基本操作是enqueue(入队)和dequeue(出队),入队是在队尾rear(表的末端)插入一个元素,出队是删除在队头front(表的开头)的元素。
和栈一样,对于队列而言任何表的实现都可以,而且对于每种操作,链表实现和数组实现都是快速的O(1)时间。下面主要讨论队列的循环数组实现。
对于每一个队列数...
分类:
编程语言 时间:
2015-08-13 20:10:14
阅读次数:
111
不考虑好多东西,算法考试中用得到的Queue
#include
using namespace std;
const int MAX = 100;
struct MyQueue
{
int data[MAX];
int front;
int rear;
}queue={{0},0,0};
int main()
{
for(...
分类:
其他好文 时间:
2015-08-13 15:55:45
阅读次数:
114
双向循环链表list
list是双向循环链表,,每一个元素都知道前面一个元素和后面一个元素。在STL中,list和vector一样,是两个常被使用的容器。和 vector不一样的是,list不支持对元素的任意存取。list中提供的成员函数与vector类似,不过list提供对表首元素的操作 push_front、pop_front,这是vector不具备的。和vector另一...
分类:
其他好文 时间:
2015-08-11 18:42:06
阅读次数:
100
工作需要写了一篇文档,发在这供大家参考,如需翻译成中文请留言。What is Genymotion?Basically Genymotion is a front end app that hooks into the Oracle VirtualBox API and gives you adva...
分类:
移动开发 时间:
2015-08-11 18:10:00
阅读次数:
204
cocos2dx中资源文件都放在Resources目录中,编译后会自动复制到exe所在的目录中。核心类是FileUtils类,一个单例类。三个重要的函数void addSearchPath(const std::string & path, const bool front=false);virtu...
分类:
其他好文 时间:
2015-08-11 17:51:56
阅读次数:
144
It’s that time again to choose the tool or technology that we want to brush up on. If you feel like you’ve been working hard at building but maybe not...
分类:
其他好文 时间:
2015-08-11 11:59:50
阅读次数:
127
http://www.sitepoint.com/20-docs-guides-front-end-developers-5/
分类:
Web程序 时间:
2015-08-11 08:28:19
阅读次数:
155
近日帮朋友写了个python小程序,从互联网上抓取一些需要的文章到本地。为了运行方便,希望能转换成exe程序在windows下定期执行。从百度上找了些文章,发现py2exe的应用比较多,遂使用之。1. 下载py2exe 官网:http://www.py2exe.org/index.cgi/Front...
分类:
编程语言 时间:
2015-08-10 00:15:36
阅读次数:
876
Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(...
分类:
其他好文 时间:
2015-08-08 21:26:15
阅读次数:
94