码迷,mamicode.com
首页 >  
搜索关键字:pop    ( 7643个结果
堆的push,pop数组实现(挑战程序设计竞赛)
堆是形如下图的二叉树 堆的最重要的性质,就是儿子的值一定不小于父亲的值。树的节点从上到下,从左到右的顺序紧凑排列。 【插入数据】push   首先在堆的末尾插入数据,然后不断向上提升直到没有大小颠倒 【删除数据】pop 从堆中删除最小的数据 先将堆中最后一个节点的值复制到根节点上,并且删除最后一个节点。然后不断向下交换,直到没有大小颠倒; 在...
分类:编程语言   时间:2015-08-05 10:44:48    阅读次数:143
C++ 队列模板 Queue
粘个代码功能弱爆,但是还可以用~用法:定义Queue Q;然后就Q.push(n);Q.pop()……就行了~ 1 class Queue 2 { 3 private: 4 int Head,Tail,Size; 5 int val[30010]; 6 7...
分类:编程语言   时间:2015-08-04 22:43:50    阅读次数:160
9.3栈和队列(七)——用两个栈来实现一个队列
/**  * 功能:用两个栈来实现一个队列。  */ import java.util.*; /** * 思路:需要修改peek()和pop(),以相反顺序执行操作。可以利用第二个栈来反转元素的次序。 * stackNewest顶端为最新元素,stackOldest顶端为最旧元素,利用两个栈的元素的转移来实现。 * */ public class MyQuene1 { ...
分类:其他好文   时间:2015-08-04 19:26:51    阅读次数:132
leetcode-155-Min Stack
Min Stack   Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack.pop() -- Removes the element on top of t...
分类:其他好文   时间:2015-08-04 19:12:16    阅读次数:98
windows下安装redis
1、redis简介redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hashs(哈希类型)。这些数据类型都支持push/pop、add...
分类:Windows程序   时间:2015-08-04 18:50:14    阅读次数:190
(leetcode)Implement Stack using Queues
Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top()...
分类:其他好文   时间:2015-08-04 15:34:50    阅读次数:96
Redis详解:lists数据类型及操作
list是一个链表结构,主要功能是push、pop、获取一个范围的所有值等等,操作中key理解为链表的名字。 系列文章: Redis详解:strings数据类型及操作 Redis详解:hashes数据类型及操作 Redis的list类型其实就是一个每个子元素都是string类型的双向链表。链...
分类:其他好文   时间:2015-08-04 15:02:51    阅读次数:124
数据结构之queue
queuequeue先进先出可用函数empty(); //判断队列是否为空size(); //返回队列大小top(); //返回队首元素back(); //返回队尾元素push(); //入队pop(); //出队priority_queue优先化队列默认为从大到小,对首元素最大,队尾元...
分类:其他好文   时间:2015-08-03 22:14:18    阅读次数:124
leetcode-232-Implement Queue using Stacks
Implement Queue using Stacks   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.pe...
分类:其他好文   时间:2015-08-03 19:14:35    阅读次数:133
leetcode-225-Implement Stack using Queues
Implement Stack using Queues    Implement the following operations of a stack using queues. push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- ...
分类:其他好文   时间:2015-08-03 19:13:06    阅读次数:150
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!