Question bank › Queue
Dsa Queue Medium

Event Queue Processor

You are tasked with processing events in a queue. Each event has a unique ID and a priority level. Events are processed based on their priority: higher priority events are processed before lower ones. If two events have the same priority, they should be processed in the order they were added to the queue. Your program will read a list of events and print the order of their IDs as they are processed. The program input format is as follows: The first line contains an integer n, the number of events. The next n lines each contain an integer ID followed by a priority. Output the IDs of the events in the order they are processed. Example: Input: 4 100 2 200 1 300 3 400 2 Output: 300 100 400 200

Key concepts

queueschedulingprocessing

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.