Get current working directory



Download 0,84 Mb.
bet4/21
Sana21.04.2022
Hajmi0,84 Mb.
#569000
1   2   3   4   5   6   7   8   9   ...   21
Bog'liq
notes2

Enqueue Operation


Queues maintain two data pointers, front, and rear. Therefore, its operations are comparatively difficult to implement than that of stacks. ( queue da front va rear ko’rsatgichlari bor, huddi stack dagi top ga o’xshash )
The following steps should be taken to enqueue (insert) data into a queue −
Step 1 − Check if the queue is full.
Step 2 − If the queue is full, produce overflow error and exit.
Step 3 − If the queue is not full, increment a rear pointer to point the next empty space.
Step 4 − Add data element to the queue location, where the rear is pointing.
Step 5 − return success.


Dequeue Operation


Accessing data from the queue is a process of two tasks − access the data where the front is pointing and remove the data after access. The following steps are taken to perform dequeue operation −
Step 1 − Check if the queue is empty.
Step 2 − If the queue is empty, produce underflow error and exit.
Step 3 − If the queue is not empty, access the data where the front is pointing.
Step 4 − Increment front pointer to point to the next available data element.
Step 5 − Return success.


Exceptions


Similar to other Queue Operations, executing DeQueue on an empty queue throws an “Empty Queue Exception” and executing EnQueueon a full queue throws a “Full Queue Exception”.

Applications of Queue


Following are the some of the applications that use queues.

Direct Applications


  • Operating systems schedule jobs (with equal priority) in the order of arrival (e.g., a print queue).

  • Simulation of real-world queues such as lines at a ticket counter, or any other first come the first-served scenario requires a queue.

  • Multiprogramming.

  • Asynchronous data transfer (file IO, pipes, sockets).

  • Waiting times of customers at a call center.

  • Determining the number of cashiers to have at a supermarket.

Download 0,84 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   21




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish