Question: java programming Design a Queve with (1) lookup time of the maximum elemene - Maintain two Queues a Main Queue and Max Queue holding the
Design a Queve with (1) lookup time of the maximum elemene - Maintain two Queues a Main Queue and Max Queue holding the maximum volues from the Main Queue. ghe Main Queue contains the dements The max Queue contans the elements with Marumum value The max Queue would have to be a double ended Queue toremore elements from both ends example Write Code for this example We add 1 in main Queue, 1 mill also bepesent in Max Quer Main Queue: 1 Max Queue: 1 Now: weinsert 4 intomain Queue Main Queue: 41 M ax Queve: 4 / we will nat need one in max Quare Now we insert 2 inte main Queree Main Quere: 241 Mon Queue: 24 Now we insert 3 intomain Queue Main Queve 3241 Mad Quene 34
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
