Implement a class Queue which supports the following operations:
boolean isEmpty()
Returns true if the queue is empty, and false otherwise.
int peak()
Returns the value at the front of a non-empty queue without deleting it.
int pop()
Removes the item at the front of a non-empty queue and returns it.
void push(int o)
Inserts the argument o at the back of the queue.
int size()
Returns the total number of elements in the queue.
You can use an array as your basic data structure and set its size to 100, i.e. assuming that the
user will never enter more than 100 items.
Your not allowed to move around any elements inside the array. Instead use two integers front, size
which indicates the front and length of the queue. Then wrap around at the end of the array when
accessing elements, using the mod operator.
please help me to do this
javaPrasad April 21, 2011 at 11:37 AM
I want ask questions for java
javaPrasad April 21, 2011 at 11:38 AM
I like this
waste fellowlaks April 15, 2012 at 9:57 PM
is this program for queue?
queueamila May 30, 2012 at 1:51 PM
this programe have lot of errors......
java212, implement the queue in javamay zhu October 10, 2012 at 4:09 AM
Implement a class Queue which supports the following operations: boolean isEmpty() Returns true if the queue is empty, and false otherwise. int peak() Returns the value at the front of a non-empty queue without deleting it. int pop() Removes the item at the front of a non-empty queue and returns it. void push(int o) Inserts the argument o at the back of the queue. int size() Returns the total number of elements in the queue. You can use an array as your basic data structure and set its size to 100, i.e. assuming that the user will never enter more than 100 items. Your not allowed to move around any elements inside the array. Instead use two integers front, size which indicates the front and length of the queue. Then wrap around at the end of the array when accessing elements, using the mod operator. please help me to do this
Post your Comment