Question: A ) You are managing a task scheduling system for a company. Each task is assigned a priority level, and the company wants to process

A) You are managing a task scheduling system for a company. Each task is assigned a priority
level, and the company wants to process tasks in order of their priority, with the highest-priority
tasks being handled first. Tasks with the same priority can be processed in any order.
You need to write a program that sorts the tasks using Heap Sort to ensure that the
highest-priority tasks are always at the front of the queue.
(Real-World Context: Tasks in a company's project management system have varying levels of
urgency. Higher priority tasks (like system updates or urgent client requests) should be
completed before less critical ones. You must organize these tasks so that the highest priority task
is always the next to be executed.)
Input: An array of task objects, each with a priority (higher value = higher priority) and a
description.
[{ "priority": 3, "description": "Respond to emails" },{ "priority": 5, "description": "Fix server
issue" },{ "priority": 2, "description": "Update documentation" },{ "priority": 4, "description":
"Prepare meeting agenda" },{ "priority": 1, "description": "Clean workspace" }]
Output: The tasks sorted by priority in descending order, so that the highest-priority tasks come
first.
B) What is the time complexity of Heap sort in the Worst case? What are the advantages and
disadvantages of using Heap Sort over other sorting algorithms? (30 points)
A ) You are managing a task scheduling system for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!