07:32
practical-exam-csd201-sp24-d...
2/2
Studocu is not sponsored or endorsed by any college or university Downloaded by duy Huynh (
[email protected])
48
Xong
PRACTICAL EXAM - CSD201 - SPRING 2024
Duration: 85 minutes
This assignment is designed to explore the management of a task dataset within an application framework. The dataset consists of tasks, each identified by an ID,description, and prioritized numerically. The tasks are as follows:
Task ID
Description
Priority
1
Security patch for vulnerability
100
2
Add login feature
80
3
Update documentation
40
4
Fix email notification bug
90
5
Refactor user management module
70
6
Implement data caching
85
7
Optimize database queries
75
8
Write unit tests for new features
60
9
Upgrade third-party libraries
50
10
Review and merge pull requests
55
1. Implement a Task class encapsulating ID, description, and priority attributes. Include a compareTo method to facilitate task comparison based on priority between tasks. [1 marks]
2. Write a main function in which initialises an array Task tasks to hold this dataset of tasks, then demonstrate by print out tasks. [1 marks]
Discuss the advantages and disadvantages of using an array for task management, focusing on access, insertion, deletion, and search operations,by comment in code. [1 marks]
3. Still in the main function, implement the MergeSort algorithm, to sort this array of Task objects by using the compareTo method for comparison(based on the priority of the tasks) (2.5 marks]Why is MergeSort stable and why is Quicksort not stable? [0.5 marks]
4. Implement a max heap data structure class MaxHeap for efficient task prioritization, with void insert(Task element) method inserting tasks in a way that maintains the heap's property and Task remove() method removing and returning the maximum element from the heap. [2.5 marks]Which are the main advantages of heap data structure?[0.5 marks]
5. Now in the main function, Initialize a MaxHeap object, insert tasks into the heap individually, then remove and display each by using the heap's remove function. [1 marks]
Note: Submit 1 java file only!
Downloaded by duy Huynh (
[email protected])