
groupon
文章平均质量分 66
jialuyyy
这个作者很懒,什么都没留下…
展开
-
implement a stack using queue
Use two queues to implement stack. q2 is used to make sure the new element is always at the front of the q1. public class Solution { Queue q1 = new LinkedList(); Queue q2 = new LinkedList(原创 2015-06-17 12:25:46 · 237 阅读 · 0 评论 -
implement a queue using stack
//implement a queue using stack public class Solution { Stack stack1 = new Stack(); Stack stack2 = new Stack(); //pop: dequeue in stack1 public void dequeue() { if (stack1.peek()原创 2015-06-17 12:34:48 · 216 阅读 · 0 评论