stack
文章平均质量分 63
jialuyyy
这个作者很懒,什么都没留下…
展开
-
implement a queue using stack
//implement a queue using stackpublic 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 · 210 阅读 · 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 · 230 阅读 · 0 评论 -
Basic Calculator
Basic CalculatorImplement 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 · 199 阅读 · 0 评论 -
Ternary Expression
Ternary Expression a?b:c a / \b ca?b?c:d:e a / \ b e / \c da?b:c?d:e a / \ b c / \ d einput: String exproutput: Expression原创 2015-06-20 23:48:11 · 278 阅读 · 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 · 435 阅读 · 0 评论