Q1_20251109155435.webp
E

Q1_20251109155435.webp



Task: Contains information of a single task: taskId (String), description (String) and priority
(int)
TreeNode: Includes a Task object, a left pointer and a right pointer for Binary Search Tree
structure.
• QueueNode: Includes a Task object, a next pointer for Queue structure.

TaskBST: A Binary Search Tree structure. This tree stores given tasks by the normal BST order
based on priority.
Completion Queue: A Queue structure (implemented as a linked list). This queue is used to
manage the given tasks in FIFO (First-In, First-Out) order.
Students are required to carefully read the provided code segments to fully understand the relationships
between the classes and the functions within each class. The specific task of the test is to execute the
following requirements:
1. f10-2.5 marks: Implement Basic Queue Operations

File: CompletionQueue.java

Methods to Complete:
o enqueue(Task task)
。 isEmpty()
• Task: Implement two fundamental operations for a queue. isEmpty() should return
true if the queue is empty, and enqueue() should add a new Task to the back (rear) of
the queue.
Expected example output:
>>> Testing fl: CompletionQueue isEmpty() and enqueue()
Is queue empty initially? Yes
Enqueuing two tasks...
Is queue empty now? No
Final Queue State:
---Completion Queue ---
(C01, Completed_A, P:99)
(C02, Completed B, P:100)
Zoom
- FUO
+ 100%
Close
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
eternal_purity
Ngày thêm
Lượt xem
2,736
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom