Write Java Programs Solve Following Problem 15 Points Given N Queries Query One Following Q37073898

Write Java programs to solve the following problem (15points)

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

OR
OR

Leave a Comment

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