Write Java Programs Solve Following Problem Given N Queries Query One Following Types 1 X Q37067962

Write Java programs to solve the following problem

You will be given N queries. Each query is one of the followingtypes:

– 1 x: Enqueue the element x into the queue. – 2: Delete the element at the front of the queue. – 3: Print the maximum element in the queue.

You should use the Java LinkedList API methods to implement theQueue interface.

Input Format

The first line of the input contains an integer N. The next Nlines each contain an above-mentioned query. You can assume allqueries are valid.

Output format

For each type 3 query, print the maximum element in the queue ona new line.

Sample input

10

1

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.