最近在LeetCode做题,二叉树出现错误时不好排查,于是自己写了一个函数,将前序遍历格式字串转换成二叉树。 形如 "AB#D##C##" 的字符串,"#"表示孩子节点为空,算法如下: 1.当前节点进栈 push(s,t) 2.出栈: pcur=pop(s) ,判断当前字符 a 不...
分类:
其他好文 时间:
2015-08-03 16:24:29
阅读次数:
89
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-02 21:24:47
阅读次数:
121
用两个栈实现队列的push() 和 pop()#include
#include
#include
using namespace std;template
class CQueue
{
public:
CQueue() {};
~CQueue() {}; void appen...
分类:
其他好文 时间:
2015-08-02 20:06:21
阅读次数:
117
用栈实现队列
leetcode :
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 ...
分类:
其他好文 时间:
2015-08-02 16:53:21
阅读次数:
141
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 o...
分类:
其他好文 时间:
2015-08-02 15:02:17
阅读次数:
82
1、redis简介
redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hashs(哈希类型)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操作,而且这些操作都是原子性的。在此基础上,redis...
在c++的STL中priority_queue相当于堆,使用的操作有push(), pop(), top()等;
使用方法及实例:
#include
#include
#include
using namespace std;
struct node{
int idx;
int key;
node(int a=0, int b=0):idx(a), key(b){}
};...
分类:
其他好文 时间:
2015-08-01 23:41:30
阅读次数:
338
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...
分类:
其他好文 时间:
2015-08-01 23:17:36
阅读次数:
108
Redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操作,而且这些操作都是原子性的。在此基础上,redis支持各种不同方式的排序。...
分类:
其他好文 时间:
2015-08-01 20:39:07
阅读次数:
152
邮件相关协议SMTPPOPIMAPMIMESMTP:简单邮件传输协议,用于传送电子邮件。SMTP服务器把消息转发给用作接收消息的SMTP服务器,用户可以通过POP或IMAP协议获取消息。POP:邮局协议,当前版本为3,所以也称POP3,该协议主要用来接收邮件。IMAP:接收邮件的更高级协议,当前到第...
分类:
编程语言 时间:
2015-08-01 16:57:56
阅读次数:
142