![](https://i-blog.csdnimg.cn/columns/default/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
stack
文章平均质量分 63
jialuyyy
这个作者很懒,什么都没留下…
展开
-
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 · 214 阅读 · 0 评论 -
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 · 234 阅读 · 0 评论 -
Basic Calculator
Basic Calculator Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or minus sign -原创 2015-06-18 02:26:09 · 204 阅读 · 0 评论 -
Ternary Expression
Ternary Expression a?b:c a / \ b c a?b?c:d:e a / \ b e / \ c d a?b:c?d:e a / \ b c / \ d e input: String expr output: Expression原创 2015-06-20 23:48:11 · 281 阅读 · 0 评论 -
Implement Stack Using LinkedList
import java.io.*; import java.util.*; /* * To execute Java, please define "static void main" on a class * named Solution. * * If you need more classes, simply define them inline. */ interface S原创 2015-07-04 23:42:44 · 439 阅读 · 0 评论