SAMPLE PROBLEM FOR DEMO


Submit solution

Points: 20 (partial)
Time limit: 8.0s
Memory limit: 64M

Problem type
Allowed languages
Python

Problem Statement

This is a simple data structures problem. Your goal is to complete the queue ADT and evaluate its functions.

Input:

  • Testcase contains integers N, M, where N is the size of the queue, and M is the number of operations in the test case. Next line will include the size, and next M lines will include series of operations of the following type Character, value, where character indicates the queue operation E-enqueue, D-dequeue, F-front position, R-rear reposition, Fr - value at front, S-size, I-isempty, DK - delete kth element in the queue. For enqueue and deleteK, it is followed by a value, others will not be followed by a value. After enqueue, the contents of the queue should also be displayed.

Output:

For each testcase, output the result of each operation separated by a newline. The output of enqueue should be the content of the queue $($print function given$)$. Dequeue should output the returned value, front the value on front, size the size of the queue, and isEmpty should return true or false. If queue full when enqueue, return QueueFullException case sensitive. If queue empty when dequeue or top, return QueueEmptyException case sensitive.

Sample Input:

Copy
    5
    13
    S
    I
    E 1
    E 2
    F
    E 3
    E 4
Fr
    S
    E 9
    E 10
D
    DK 2

Sample Output:

Copy
    0
    True
    1
    1 2
    0
    1 2 3
    1 2 3 4
1
    4
    1 2 3 4 9
    QueueFullException
4
    2 3 4 9
    2 3 4 9  
    2 4 9  
    2 4 9  
    2 4 9

Comments

There are no comments at the moment.