0% found this document useful (0 votes)
76 views7 pages

DSU Assignment 5

Data structure using c programming assignment on chapter 5 2 year/3 sem/k- scheme Computer Engineering MSBTE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views7 pages

DSU Assignment 5

Data structure using c programming assignment on chapter 5 2 year/3 sem/k- scheme Computer Engineering MSBTE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Ho.

S
(DATE:
STD: DIV: |PAGE:
NAM

oDelin queue ' ditfenent bypes of quenes


f alipeoL cdalaCuctuethfch folloug the firgt Io firt
Ans A queue
Dut tuo piociple tohich roean3 thot elernent insentedfrst vot.
be temoued first
Queue 9 an Ab9troch Data ipe 6ADT) 3irnilax'tothe siock ArT
A
Aquee
ond Can alo be inplerrerted using Ao
There ate 4 types of queues namely:data Cituchure fn ohich data
is a linenM
C0neag Queue iA quene end,called the teas,and deleted froro
lCan onty be ingerted at one estriionz ensure that tne
the front.TheSe
he otber end Called
the ordeèn Uohich they
in
data orepmcessed thrpugh the quene
arereceied.
Queue:_ina Ctcula quene,all nodes aye treated as
5CtculaL
cu/au. lasl_node is Coone Ched batk tothe first node,Cicw ax
ct
Queuefs also_Called aa Ring8uffere fnded QueLLe, iosert
Eoded Quee):tn Double
a Dequeue (Double at both enco, that 3ont
and deleke operatioo Can be octL
T
and canDf the queue. îtema LObich haue
Piorfky Queues Priotity queue Contains data
Some.pnésel prtorits. while gernouing_an element JaLom apriczity
,the_claia îtem toth the highest priority s removed
queue
ist

WORLD SJAB For Educational Use


DATE:
PAGE :

NAME:
STD.: DATE:
DIV.:
|PAGE:
Stateapplicattons of Queue and
Conditions uoth ample. enplain ouylowg
Ans
Applications DE queue are as follows&
undertous
Pioig usinq the
be
prined,the priDtex omputex: When Sevesnal
douument
pxints the documents in ffO s axe to.
Resenvation
Teservaton oySkmi ReseHUaHons Sudh os aíH method Ontu
lCome ystema Use queue to ÍSSsue
Erst Sere ticket oN Yailupau
AComputer basYs ie FLEO
mehod.esTesemaHfona Dn
first
access ADmNetuorksi
SeHVer tDComputex netwcnhs use queueS togiue
ReHueA in fIfo method. SeueHal Clientswho ne Conneted othe
toA0peratfng Sysiem
eoch unit bs StoxiDmaipiain Quene în allocatfog
them in buffey thepoes
uue full Condition (Overfloo
Before perjotming insext Condion)
opertalfons. oe muwt chech tohether
the queuefs'full ornotaIf the
ithe maximum Sixe Of the renH poinkes0s going beyond
OCCUrS. queue then the queme Ouexflos

|D28o|uosD60k70 Connot be fnserted


The Code to chech Ouejlouo Trear
itlrears=Max-1) Condition D aqueue is qien helou

WORLD STAR For Educational Use


DATE:
NAA BTD: DIV PAGE:

Queue EmpBy Condition (underfleo (ondiion)


Beibre peyeming any delele opeaion, DDe mut chech whelhe
the queue s empt on not
the Queue3 emptyoe Cannot
pefom the deletion.
The esutt of illeqal altempt to delee an elernenl
queue i3 catled the queue under ftoo Condition. roro1heeroply

front Re
The Code to Check underftow in queue asfollowst

lPrinet In Queue fs &mpty)


Difterentiate beween Statk & Queue
Ans Stack Queue
aA Stachis alinea daia(0Aqueue is atinedx dala Sru ture
Struckute fnLohfch element_muol°ch fnsetfon takes place at one
may be added or delekedlend Caed geay and deletiontake,
one énd only Called ihe place al ancthen end cailed asfnn

OStack is lIFO Lost-fo-£ist-0u) Queue fs ELEoCFist-în- fist-o)


Siack has. apofnier VaiableQueue has tuoo poinleL Vaxdobles
TOP f'or opealiong |fiont and steaL for apeaions.
WORLD STAB For Educational Use
DATE :

STD.: DIV.: PAGE :


NAME:

bolb direchiong. ) font and reaH MOve fn dne directfon


DToP moves fn
VOcant posiHoOs aHe |Dnby
Hepce,
NUsed.

9The elements aHeremoved io ne =


in the
Te elemeois are poppedthey 8ame orden in ohich they aTe
reverse brdes io which Ladded.
loee puushed.
3hackaePuSH Opesaions on quue a e
operaons oo Enqueue and Dequeue
and PoP

element fnto qutue £ deleke


Qmplement a Cppqram to Énseat
element Juom the queue
the
t ipcude <stdio-h
Ans #foclude <conio.h>
#iDciuode <Stdlib.h
font=-1, reaH=-,iem;
intg (26,n,
vold foserfioo
'elCrear:En)&R(Omnt=e(rear+) l(Gmoteerear+1)

Prioir( ln Queue Ousjloaln


else fr (reareso)
fmnt= re aH=-l;
elseie (rear=zn)
For Educational Use
WORLD SJAR
DATE:

NAME: STD.: DATE:


DIV.:
PAGE:

Pot(Entothe
&conf item:),
("d', sitem);
qhea -îtcm,
Priotdis intexesked lnln',itcm);
void deletion c0

PrioHE"n Queue underflouw ln),


item: qftonal
IfEmnt 2-a)
front=0:

else frCfront=n)
frontel
else
ont =fonttl;
Printe["In %d is delehed In'; ie,
Vcid shou)
for (ht feo;ikereasitt)
Prionf"dlL4m.
int main C)R
WOALD SIUE For Educational Use
Fxecutor

NAME:
STD.: DIV.:
DATE :
PAGE:
înt ops
PriotFC"fotea tbe Size Dfthe Queue :",
Scanf(" -d",&p).
do

Priote("n:
Printf (" Enky
delete ln2ttnsertlo3:
Afsplaylo4.Exit,
yoH Chofcelol;
Sconf(".d'&opl;
Switch Cop)
Case te
insertfon (0
break;
Case 2
deletfon CO;
break,
Case 3:
display),
beakj
Cose4s
Exit Co);
defoulti
Printr("lnvalid chofceln;

For Educational Use


DRLD SJAR
DATE:

PAGE :
DIV.:
STD.:
NAME:

ploritsy qucue witn diaqom


&slExplain wor kinq of
aColleCHon Df elermeots fo ohich eoch
Ihe piorits queue is based onits pnioritu.
element is annonqed inthe queue
queue s ColleCHon Of elemenls Such that each element
APioits the oxde iowhich
assiqned a prionity value Buh that
bas been
elements ne deleted and pDtessed omes om the4olowing oxden:
LAn element q hiqher prionity is pocessed beyore nyelement
a. Too elementg toith 1he &ame prioYits aMe proccased toiheode
fo ohich they auc Qdded to the queue.
o a prioriy queue. elemenrs QHe inseHted as pex their priori s
levela. And oben emovib a node usith higbest priorit mst he
DOEd 4irst. wheD All elemnents usitb hiqhest priorits aHe
remored, ?t xemauea nodes usith next hiqhest prioritu

LO20Bo|
NULL
-+88|
NUL

You might also like