Question 6
Question 6
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package question6;
import java.util.LinkedList;
import java.util.Queue;
/**
*
* @author Nischal
*/
public class Question6 {
Question6()
{
curr_size = 0;
}
void push(int x)
{
curr_size++;
void pop()
{
int top()
{
if (q1.isEmpty())
return -1;
return q1.peek();
}
int size()
{
return curr_size;
}
// driver code
public static void main(String[] args)
{
Question6 s = new Question6();
s.push(1);
s.push(2);
s.push(3);