Priority CPU Scheduling Problem

Given 'N' processes with their “burst times”, where the “arrival time” for all processes is ‘0’, and the ‘priority’ of each process, your task is to compute the “waiting time” and the “turn-around time” for each process using the ‘Priority CPU Scheduling’ algorithm.

Processes are scheduled based on priority, with the highest priority being scheduled first. If two processes have the same priority, execute the process with the lower process ID first.

Example:

Input:
T = 1
N = 3
Burst times = [10, 5, 8]
Priorities = [2, 1, 3]
Output:
Waiting Time: [5, 0, 13]
Turn-Around Time: [15, 5, 21]

Constraints:

  • 1 <= T <= 10
  • 1 <= N <= 104
  • 1 <= BURST[i], PRIORITY[i] <= 104
Note:

No need to print anything; focus on implementing the function.

AnswerBot
4mo

Implement Priority CPU Scheduling algorithm to compute waiting time and turn-around time for processes.

  • Implement a function that takes in burst times, priorities, and number of processes as input

  • Sort ...read more

Help your peers!
Select
Add answer anonymously...

Paytm Front end Developer interview questions & answers

A Front end Developer was asked Q. What is the difference between inheritance and generalization in the context of ...read more
A Front end Developer was asked Q. Priority CPU Scheduling Problem Given 'N' processes with their “burst times”, wh...read more
A Front end Developer was asked Q. String Palindrome Verification Given a string, your task is to determine if it i...read more

Popular interview questions of Front end Developer

A Front end Developer was asked Q1. What is the difference between inheritance and generalization in the context of ...read more
A Front end Developer was asked Q2. Priority CPU Scheduling Problem Given 'N' processes with their “burst times”, wh...read more
A Front end Developer was asked Q3. String Palindrome Verification Given a string, your task is to determine if it i...read more
Paytm Front end Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits