399_33_powerpoint-slides_Chapter12
399_33_powerpoint-slides_Chapter12
in C
Pradip Dey & Manas Ghosh
Priority queue
Priority queue is a special type of queue in which
items can be inserted or deleted based on the
priority. Different types of priority queues are:
1. Ascending priority queue
2. Descending priority queue
In an ascending priority queue, elements can be
inserted in any order.
But while deleting an element from the queue, remove
only the smallest element first.
In a descending priority queue, elements can be inserted
in any order but while deleting, the largest element is
deleted first.
It is to be noted that for elements of same priority, the
FIFO order is used.
Direct Application
Print queue: The most common application of a queue is
the print queue. When multiple print jobs are sent to a
printer, each printing job is inserted at the rear of the
queue in the order it was sent.
Ready queue: Processes waiting to be executed by a
CPU are usually in the form of a queue. These may also
take the form of a priority queue.
For example, in a multi-user system, there will be
several programs competing for the central processor at
one time.
Direct Application
Message queue: In a computer network, messages from
one computer to another are generally created
asynchronously.
Any type of stream throughput of I/O will use a queue.
Scheduling of jobs within a time-sharing system is another
application of queues.
Auxiliary data structure in algorithms
Queues are used in finding the shortest path in a graph
Queues can be used for Discrete Event Simulation
primary properties:
In a tree structure, one node is distinct and is called the
root. The root is the top-most node from which edges
originate, but no edges terminate.
Nodes may be categorized as a parent or a child or a leaf.
All nodes are related to the root node.
The different types of trees structures in
decreasing order of generality are:
Trees
Rooted trees
Ordered trees
M-ary trees and binary trees