148k views
4 votes
In a ____ queue, customers or jobs with higher priorities are pushed to the front of the queue.

A.
structured

B.
divided

C.
priority

User Sullivan
by
6.8k points

1 Answer

5 votes

Answer: In a priority queue, customers or jobs with higher priorities are pushed to the front of the queue.

Step-by-step explanation:

A queue is an abstract data type which is an ordered set of elements. The elements are served in the order in which they join the queue. The first element which was put in the queue is processed first.

The operations performed on queue data type are dequeue and enqueue.

Dequeue refers to removal of the first element from the queue after it has been serviced.

Enqueue refers to the arrival of new element when the element is added at the end of the queue.

A priority queue is another implementation of a queue. All the elements in a priority queue are assigned a priority. The element with the higher priority is served before the element with a lower priority. In situations of elements having same priority, the element is served based on the order in which the element joined the queue.

In programming, a priority queue can be implemented using heaps or an unordered array. Unordered array is used based on the mandatory operations which are performed on the priority queue.

The mandatory operations supported by a priority queue are is_empty, insert_with_priority and pull_highest_priority_element. These operations are implemented as functions in programming.

The is_empty confirms if the queue is empty and has no elements.

The insert_with_priority puts the new element at the appropriate position in the queue based on its priority. If the priority of the element is similar to the priority of other element, the position of the new element is decided based on the order of joining the queue.

The pull_highest_priority_element pulls the element having the highest priority so that it can be served before other elements. The element having the highest priority is typically the first element in the priority queue.

In operating system, priority queue is implemented to carry out the jobs and/or tasks based on their priority.

User KumarAnkit
by
7.3k points