![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构:栈
fxf1012
这个作者很懒,什么都没留下…
展开
-
《剑指Offer》面试题7:用两个栈实现队列
《剑指Offer》 P59面试题7:用两个栈实现队列题目:原创 2015-04-23 21:59:33 · 425 阅读 · 0 评论 -
《CTCI》3.4 汉诺塔游戏
《CTCI》 P1403 栈与队列题目3.4 In the classic problem of the Towers of Hanoi, you have 3 towers and N disks of different sizes which can slide onto any tower. The puzzle starts with disks sorted in ascending o原创 2015-05-07 17:05:18 · 445 阅读 · 0 评论 -
《CTCI》3.6 用两个栈实现排序栈
《CITI》P1433 栈与队列题目:3.6 Write a program to sort a stack in ascending order (with biggest items on top). You may use at most one additional stack to hold items, but you may not copy the elements into any原创 2015-04-28 11:21:26 · 406 阅读 · 0 评论 -
《CTCI》3.5 用两个栈实现队列
《CTCI》 P1423 栈与队列题目3.5 实现一个MyQueue类,该类用两个栈来实现一个队列。解答#include <stack>template <typename T> class queue { public: void push(const T& val); void pop(); const T& front(); const T& back();原创 2015-05-08 21:52:44 · 339 阅读 · 0 评论 -
《CTCI》3.1 一个数组实现多个栈
《CITI》P1083 栈与队列题目:3.1 Describe how you could use a single array to implement three stacks.解答://3.1 Describe how you could use a single array to implement three stacks.#include <iostream> #include <win原创 2015-04-24 17:22:57 · 320 阅读 · 0 评论 -
《CTCI》3.2 包含min方法的栈
《CITI》P1353 栈与队列题目:3.2 How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min should all operate in 0(1) time原创 2015-04-24 19:50:19 · 252 阅读 · 0 评论 -
《剑指Offer》面试题22:栈的压入,弹出序列
《剑指Offer》 P134面试题22:栈的压入,弹出序列题目:原创 2015-04-24 10:19:10 · 537 阅读 · 0 评论 -
《剑指Offer》面试题21:包含min函数的栈
《剑指Offer》 P132面试题21:包含min函数的栈题目:原创 2015-04-24 10:16:43 · 645 阅读 · 0 评论 -
《CTCI》3.3 栈之栈
《CITI》P1373 栈与队列题目:3.3 Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the previous stack exceeds some原创 2015-04-28 11:14:19 · 447 阅读 · 0 评论