GoConqr has a new look! Let us know what you think.

Flashcards

Implement Stack using Queues

Suhas S English 1 card

Cards in this deck (1)

  1. 1push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Get the top element. empty() -- Return whether the stack is empty.class MyStack {
    Queue q = null;
    /** Initialize your data structure here. */
    public MyStack() {
    q = new LinkedList<>();
    }
    /** Push element x onto stack. */
    public void push(int x) {
    q.add(x);
    for( int i = 1; i

Information

Description
Flashcards on Implement Stack using Queues, created by Suhas S on 13/05/2018.
Created by
Suhas S
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?