0% found this document useful (0 votes)
13 views26 pages

Dat Astruc T 08976

The document discusses various sorting algorithms, including selection sort, insertion sort, and merge sort, explaining their processes and implementations. It also covers abstract data types and linked lists, detailing how data is structured and accessed. Additionally, it highlights the importance of efficient data handling in programming.

Uploaded by

ddaaa433
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)
13 views26 pages

Dat Astruc T 08976

The document discusses various sorting algorithms, including selection sort, insertion sort, and merge sort, explaining their processes and implementations. It also covers abstract data types and linked lists, detailing how data is structured and accessed. Additionally, it highlights the importance of efficient data handling in programming.

Uploaded by

ddaaa433
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
You are on page 1/ 26

EE y

| (oe = —

lo) Exolain selechion Sest


= LA. selection Sogt is open ‘which Suttessive element
Cl

“lore selected in ond placed


order nko theix —prop——
position . The Selechicn Sait is used ofl the —
Smallest element along alil,alt-1], a(n] ,
and tales change St with - AQ] - The ioteschange
—phates the emblest elementis bus puto
in the fable - S Irs lazy : 0gain locate he Second
Lo ¢ smallest ceRmtat - Then this element io placed ab
Alia] The phecess of localion offloading
> the Smallest lement Ceadinues lk unhl 7

the elements Love been Soited In asteoding


pede

Example : Ya | +

Pass 1: l G6 4% 36 24 qr BS - 22 :
Pass 2: Il 24 43% 36 Sh 9] 8s 32
oo ere ]
|

ee
FEE — if. =
IT
©non — homogenous dala ¢ Glructuges: 1
i Home nus Gdaod
e fi
~ => Tn" hum i dala olgactuse, all_{he Element bat
i Lof Same type Example a fgay Tn ben — |hen €0us ——

he “elements age. —May_OX_ 7


_ ldots olgutddes Tall
x may not be of Same type EEE fecords:
— i -
g| I
—— Ww) A Stabe ood d oh shucdores — =

Abpse whet S2E -


= Stabe dato © Stpectutes * age
| ison fired_at ——
and Strudure associated locati
3 Compile Lime Dypamic Shroduz-e age these which a
J
: expand af sheiok © 0s Seguised ding the ali
apd: there associated. memozy lotion” Change. =
_¢xecabion

- , :
I
it 2 | Define abelaack gn Ayes
T= he abstract data wd ¢ , Samebimes abbieyioted “ADT
how we Uitw Lhe -
oc ical descipli Len of
EE 15a
opens Hat are allowed +
= do ta ofl het
_ Lo _ Teqard how they will he implemented = -
without
- i Thi < . Mean g Te we aie - concened © only with =.

oe dolar | 5 teppesenting ~ and not “eth


1 Jbat
enslracied +B
nl . | hew will AE ey
© 0 shachon , we QIE
nig this leuel
iB — . The ad
aleoy nd the data
| {peaking an _encap tla Hop
i ll
by WT the details ob
| \dea 15 lat ©
hes from
Lhe imp Jebsectabin, J are ng

4 ge. olga 3
"oes 5 ics This is oll
of abstract data Age fC ——
he
hiding + SiSome _ Cotariples =
Tot, ets ol tev et
+ Stuck+ Queue
ERT ro
pe Er) = ==
bioked [1st wig, 144
_ ANT lneay
Implementotion: i
Collection of dala
Ase Llements which,
Called ‘nodes! -~The el | —
ke ements Loy. ob Moy
Stored1,0 Lonsecutive me pop
— Pointess mory locations, so
aye yged maintain lineas
— hode “18 divided _i oodesEe Sls i
nlo two padls_-
—_ pas ___%oale freee
Contain dhe infosmation el th
— _Blement ——and e In
is © Called ‘“TNFO Field! + The’ Second |
A Contains - the oddiessofthe next “node [TC
and js Called CLTNK Field!
_
os ‘Negtt
t- Pointe | r=
a Te ___Stast Con tains
addr
andr. ess
Lhe 5 Eastin
RY: the. [i nked IY Je- it fotos iL|
address | of the fisst, nde of the inked 1pe
— ist: dx ihe! LIN k __Field : pf. . |ast, node: Conbains
Nor Value which indicates’ hel. st 5: the end
n= altos fet: «Fi

C — ple mentation
Lin
of ked [is Using Cit
| _
| As linked list
- _(apsist of ‘bodes we need dn declares
I JQ Structure which defines. q Single__node- Oud 5 truchee
fev ab. least one. vasiable for dota. sechioy and
a _.poiplex fur the next nede Tn (i "oud (de
—y sould look like ~~ this-

| Struct pede
HE
| int data : : i :
| node X peat : SE. :

dy |
| oe an argey— Fill Ihe

Otder- Th Compates the pt


hot aod if the
elements given 10 value index
+ othe matchedib selusps the
element 15
fetusn =1- Limeas_geasch 1s applicd oo ThE —
Lelie ib 119 age
unoide red list when
LUNSO% Led o%
Elemeels in a isk
——
Algorithm for Sequea tal geauch .

I
search (hygay A value 1)
| Lineat

Cet 140 1
|Sebe glen 1
Shep. 2: 1 i7zn thea Jqo do sie 3
== Then Je 10 step £
: 1b (5)
| | cle,d i Set 1 de 3bT
| Step § © Go to slepZ
element X found al index i aod Salo Sip 8
| sie © z piiot
Print element not Lund -
fi S¥p rh :

itp g ° Eail
41}

|
owe [J
1 ] ame]

a
ame
=
— nT tH tithm -

Ex th
sbin. SoikwotkswiSimi
hhsexbionnsea 0re The So
rting_ of
— —2 | ITn lar.
; playing Cards’ =rhi : CotLJ 15 = tii)
Assumed ha

Beok ie _alieady _ ended’ Inthe aed |


te"
game, and “hea tt arkel: an omits Ca ET
PRde
CC 1T3h Ane selecdd —onsattel_Lad — "Qfeatlt. on {
dhe to Bek card, ib will hd ot” the 45 os
(Side 3 piherwise Wh will * he ot the [ te
Gde. The Ggme approach A Qpp.plied Li d__

linsevlien Sort
— The idea he hid the in.sexfion ose
| Sard is that fidst dake one elemeat , iterate Li,

Lid fsengh tec] occ Although 1ts_Sinle


| to se not apploptiale Ih [azger "Hata sig
| : ES
| Sets : os

[ | = cla
‘ FS
. a —
ns Hon lang b-
pe
Maorithe fog

[I
lo
|
Insertion Sart (argay) I~
_ mask fisot element as Sobed A
unsorted element A ) —
I Pox eqn
element x _ —
I 'eatiact The

fos J <= lastscrted Tndex down to 0 i 1 0


|
| if Wu g tent €lens ent Jz BE He
do He sight . he
mo ve sorted Cleat
|
and insert x fee. =~
| breal lop
Eb)
ead insertion Sork
po =

-
&
| Date |
—_—

_ 12) | Ey plain cise Sosk


m with algorithm.
— : Me: 8ger Sort
—_—
ls defined as aq 3opti algrith
— [thal works by diidims
| an aizay into. Smaller
1 Subamays
WJ J J
. Sottine ach Subatray _,—0nd then
mess ing the Spsted Subagyaye back fogethex
— {om the fl (Sorted ayray - i imple
——— deims we (an 4 J that the process of
————Mesge. Sort js to digide the fa: inio two

halves Sort each half and then ~mesge the =


'Sorled halves back Hegether “This __-pgocess 1s
Nepeatel ali the Coie altey is sorted

Algocithm | for meme Sort 3

11 | Step x lS Start
Step 2 1 declare Qo and loft , igh [oid variable -
l siep 2 1 perform, meme uretion .

felt Z tight
Teluen
mid = (left + right) /2
meTge crt (aray ! left | oid
Meise Sort Laney mid +1, tight)
MET qC (ateay eft nd Tight )
: Step
= ———r—
|
= ——

dizad vente es
es and
_- and adapta
lin ked_ list 51 e
tS F efiae data a{paclue {hal Can
linked Via io Qa
—-— ILA

Amount of emo + These lems QIC


ao indefinile [= I

sequential monney. ———


ina
| connected using ore
a loked list age called ibe “eler_
The a
elements
i nodes hae Awe fidds 1-e. data 0nd nembe ——
lf dota field a dala being stored ln —
en specific node +I L Cannob Jousk be Q slegle
yatiable - These ay bE ___mmony —nschie—plese “]- the —
data seckion af — The = dd ———
i
ihe aodd s s
eesn of 1 hs al 3
Cont ace ¢whee the oi elven
the pl ny
this is ti hew
@skoblished to mo
. 30
| todes 1g
be Tew =
co in 4} el
aie _plessi
nodes
Gnd ine lost
ues ised node ard head Ll
{ail - aa
is Called
Ca 1 he
node
I
list -—
Linked
"x | Glwoleges _ 0
The——
notuse which ollcales
=

ynamic in
9 Tivey_ area a_d quite ed. : a
_ mem0l ag when nd deletion opesaticnd Con be easily
BE impemented-
an
RB) Ee be
BE ea sily Cxecaled -
weue (a n a
we Stolk and {he Qess Aime
.
154 feduces Lhe RB
3) | licked J
s o f T a |
5 | disa do
d ne ta ge
[| | patta
nterss fequite
memory 5 ‘wasted Gs poi
"Te —

elgfagt -

fet y 3 2TT
Can be accessed 1fabend
ee
J

i do_element i
mode equeatia

ee

Ar
00055 each in hiked tisk ————
H8auEINg a. "ithe
1) ReMese ———
|| = 1 EEE)
i8
| aed
4) | Nee of data Sleuchine. I ——-- i
ate wed in eves Pegler ot Soflwete of
a ala oA
°_ Qfdonge he date Sees _— pe
PE siem te
ase. easenkial In cients of mony =o
il Tha
Cw) ik dates

efficient aly obithme > TH helps. in the gig —


_ of data uch’ as- SE ae —
lof huge pe
qeated Colecion of database. Ta te
— I tate
allows _
dan] ments — a
cu} “had dota cuctue
Seni maract 1n on.fhe Amini
I Stoted ina
helps efficient data Search ow
| Dade. Shackise
gobajeval “oo = ! Nal
| apd
a
0) | Fos specific problems FE
|uped a loge - amcunt jE ei on
Data ¢ dgucluse allowsog
wi) vo
JIT “ie bs
* dgta Such a
. of -

|
ee

dgesilbo—— 5 —
Space Complex by of an
5 ) |Ie
alqos] then =
ce Compleaity = of Qn" Ny
of Mem of Ipace zequised by the
in tiga is life a } gE.
algotithm 15 _equol
ack
two Components:
Tui,

tequired fostore
G Space
fied pa ab that je
and _ Fr {het Ofc a
Fa For @dampl®
_plablen
—_—

he Pr “the
s d . p r SE
ogl um :
of
and Co ns ta nt u |
| Simple vagiable ee
——
a

eke
yatia Hes

apited yo
I

JE em
0 gpace
vafio ble past 15 of the
jp on the Si
a)2C depends Sm
meMemmbly ETT
b __ ¢r am pl e . dynamic
pichlem: F o , Ea
im
lt Spate he, a
fecu p Si on $ l a c k
5 i
|
|
| pe]
He =
age No.

|
ft

-
——— "
a
TT A CRN LA Ait Fey
= ge. divesbiona] array.
1s G8 peectalized fam of
Te wd — dim
A ppc bog 0) ensional K ~Qtray
‘which - have | i disdsiag,_r
mult dimen Sion) Er
— :
AXfeyS___ |
LITE is oadely used a rong all pea ’

\
lw Wptesent_Qa malig Wo
]
al Structure.
a
K
a
si
{
| - BP SI PS —— = TT i)

\ — | Syolex _ a)
spe

en o. one
ott [rab 151 a. (sme. 2, | dimes PR
datatype

wn | nd asmepd Se Lo 13 trample
Nena — pa

_ 1 x i bi
= 8] |;Memory Spedaticn Cd ope EE
Tita) —
LO which -
dias aga at age lineat. ~peKey
— — Ore -
tn lhe Sucressive Ine mary ow
- elemeats. amp
at the very First’ positicn
i he cleat
ye
ta the ak js CCalled its base address

in a

int oer (5) 5 .

+8 19s | 4s Te
| Element |[24 |
Todex larelo]-loo | an(il-7 lat?) 7 ae(s):7 | ase(4]-7

we have defined ar __ateay of fe elements oo


os
inttqets type ‘whese {unt om. flencpd is of
laf
addeess loo: Ge the ebwent ample] is —n
base
| alged ot base esMow
(oar
0ddw s fer Colello ——0u
5Eo odds —u t
of the next elemen
1 the
al] (an use Lhe flowing fremute.
iGe —

aul = - et (= lot Hsince_nle capi + bes mee——


Sa
ofa] = lot 4¥2=JeB A: a
ESTAS) EN TEX oc
| awi(y]= leo kA tes. I Sy
Pape No.| ]

Data

he

a Tei Do
n Babble... Sotb._ with algorithm: rith
~ 13) Explai Sosting i algo m thet works =
— ||Bubble Soest is a.
Stepping thtough | ios thot need to
§ by ve peattdly
pai¢ of odjatent items: :
be Soted , Compatiog each
a
_ Swapping Ue if Lhey ate in lhe wrong
I
passing peoccdure is gepeated until
E—— ovder Tis
ase Toquited | b indicating Lat the fist
loo Swaps
Bubble Sort od ils hame because |
—_—— | 15 Sovted
elements bubble tooardy he top of the
Small
| liste The bubble Sogt algorithm Gao be
© inthe
PpiiRe— by placing - larger elements
| dial position. After every pass, all_elemen :
the last Swap are Socted ard do
after
need to be checked Ogain_, there by
not
the _ beacking of swapped variables.
Skipping

—> | Algosithm grt


log babble
— 1
~ babblesort (yriay)
| n= length (actay)
I
Il peat oo
Seoapped = false
2° 0 oh I
if apay li-V) 7 awrayli) then
|S Sap Coe 4] ati 1h
Swapped = fue oo

end fos ]
| b= n-1_
| ugh} nel Sessipped - oo
| end bubblesest:
[Define attay and ids pes
The QBtay Slofes 'Q Ei Pie =.5 ize Sequential Collection i
of. elements of the Some _lype-" MN) asrop comisg
of
i | Contigu tus emory _lotaliong + 1a address
(oes pond 5 to he fissh element ond the
h iqhest address to fe last element

The - Types of : Qffay -.

Single dimen sional Qlvqy -


Js ’ N

The Single dimcadional Qfray_ 15 one of die host


J
Used Qizay - TL 1s a linear Colleckion of Similad
| Hype of "data ond the allsceled (remot for all
he Hota blocks in the Single - dimensional afray
Yemains ~~ (onsecutiyes

Syntan fax Sing le di mea bional agaay-


< J i J

datatype Gfroy.- nome [amos size J; id

// Cua mole :

|I int wen num bers [5]


4. -

ype v5 a dpe of data of each’ aries block - -


dala
= hich
whlc —
li G¥ fay—Yhore tls the< name of the Qrzay
it - | =
we Can ¥e fos lo
| -
the” num bes of ! blocks sf 'hemery
fay Size 19
J= assay Going: brave - . v
-
- -
—_—ay| feel
ee —— Dato | | | |

leg
A |
1 Tin
rT
twa —q:
———r
_
—linked list ' and {iy
-
adua
it
{o
JE Li and L

TT dis, dugg a ey - J B
_ - _ —
5
N —
Tivo
— ~
way feb

Loked list to a vagialion of
—_ oh ed list jn which —
~hovitg alim ig possible in both —
|| As) eilher _— {oon Wl ond batkwazd ) Parsi. ag hae
f-Lompared 4p
— I im
Single Linked List
© Following” are the
ob lont
do Undessland _1he 7 tence it of ~
— 1 doubly | RE

Shan lick = Fach Tok of a link ed list Con {ate a dota


eT Called an element :
i Newt 2 Fach Yok of 0 fmked [of tam a ho i
a — lhe neat
link coved hewt
——L Pre
¢ y
Bach link of a baked [of Contains a link
EE wa to the meeyious link Called poev-
— dud J Lioked List + a linked ligt footwies#8
+
a link 10
_ Lhe Preeieos link Called Prev. lost

1) | 4 DLL Con “wes travesed in both frword ond


I backward dicection -
i) I The delete aperaticn in DLL is niece efficicat
C lif pein fe to the node to he deleted is given

-_— Disadvantages wb fe - Ciihy linked list .3


|

DLL Fergie Cylra__ 3pmee poinify


[rue nede in
single
|

— 0)
|l poTANtinterisoperthpuatousbiolegh fo jmplemea) t DLL | with
1

ns Teguise an p1lea pointes edovs


—h—rT

— |1)
FC
nen

N
oo i
Ct be _malptained-
=
— LL

(Paga No \ -—
on ]
I

| E. ——
; Space I Leith in ret
A “ime
| Time Compal ob an alaprithns _adusie we Ba
= [Time Com plexi of an” dlqenlhm Lhe [7
epgeseats
Beqpised_ by the algosithen to |

Xi =
a?
\ amount
tw. to Completion: |
Seg uitement = (an he define] _oneia Numerical | BE
E = dl Time
Tn) 0 whee Tn) Can he. measuzed as the |
§ function
eps weed each Step . (onsumes__m i
¥ | Numbez of
| Constont Hime x ; i ] Lt
, eid hind of dwo pn-bits inbeqei.s {uke ot
iar) | Fot~ example
lo Steos Then the total Computational time is ic
AT) = kop where (isl the time tuken fof |
| addition of Ywo bils- E
Asymplotic on gefers to “Gempyting the funding |
canst
Wn mathe molical © units - of | 3
Lime of operation
| Compudotion ‘ .

" poegiam Cx ccation - _


B eat: (ase — Minimun- Hime pany
1)
Average time feq used for prey fam @xecu tion: I
iD) | By esaqe (gsc —
== Mga Hone ( weed ot {26eq fom Executions |
wr) || wogst (ose 17
R : : 1 r

r
—&
=
ee The BAe

(Page No.

| Dato ]
Ne ———————

8 9) Adwaplages and disadvontages of _ a


=> hwy Ts a sed of Values
of sim Jatt pe: fray
Clemedls shag Common pame and isa _ efemenls ote
|I5%ed _in Sequential eon ay locations ~
— — _

~~ Mdveatages of agmays
= i) LIE 1s Capa ble of stag a¥_Many elements at o time.
w) | Allows Fandom QcesSing of elements fee Ong element
Ry = Ihe Qesay can be tandanly Accessed using fodexces .
] |
| disaduanta es of _qaxgayS
9 | Pred lerm {ning the Si2e of fhe Q¥ray i5_ a must -
[4] 4 Mem ory Lostoe at 9 hogtage ;
i) The re is a chance

Wl To delete one clement In the Qfrey , wR heed to


|
averse _theeugheut The Asyay -
wll To delete bne element fa the diay pwX need to
tran verse thresh put the ray .
1a) Dele Shack and weile lhe offtalion on.(pe stack.
= Slack te a fiecar sltac fuze or Collechn_of
ozdes
may be te Jase or deleled
date _in__which Hews
| _Taem one gad Called _ao__topof slack The Sleek
~opeeates in LTFO (Last ET _Qny element —
|
! 1nsealed lien top wil be incteased pe oad 1—
Qoy lmeal delefed then Ap wid deceerrd
by” 1 1

1
Top = Top +1 (insection) —
Top = Top = 1 (deletion) ‘

operations in Sta K- Get “Push and ™ Pop”

od Rlaarithm fox push

| Tnaestion Ca, top, item, Maz)


Dl Tf top = mat then print Stock bubsflow"

©@ | exit
flee
ni) | op = dep 41
wl | a [top] = item
v.] | vit

— | Algczi the {ox pop:


|
1) | Deletien Ca, top, idem)
i) Tt top =0 lheq Diint Stack overflow

_Eyit
| €lee.
| Tl em za Phen |
| Cnd 7
iv toy = top -]
I El : le Eun;
Paga Ma.

Data
I

1) Define dole stricture or=dess


—> A data he Ya a—Spedibacd forme » hgnizing

ATT © the tecord “the lable | the tree


JE the
Gnd So on fny: dota ettucdue is —desigoed to
—_—
J Cfganize data “fo said eq ugpose 50
that 14 Can be accessed “Qnd worked ‘with’

p— in apnfoptiole ways © In Compufer ple an ing La"
3 dota S{gachue may be selected desisned
Sire data le the | pags of working
| to
. on it with varius ~- Qloonithm © Dols Steucwze is
fa in
-
Ofganizi
|
ond.

1a way of cellecling3 : }
J = opeza tions
uch a wa {het we fan neZfeem

dada. jn — an effective ways.



Jo. on these Bs

— 93 Qassibicotica of dole gtsecture-


ly i
i _—

i Primitive Gnd non Plimi be dato Srudure:


ail
that ote atemic Ge” faled
| = [The da la otruduce
Teo! 7 and ¢hogarlecs -
age Lo Leger
— J
dota {ruchute thot ~ age pot atomic ore
ber The
0% eps . examples are
— Td pe iy nil
=fLtia Liu

msds Orga

lok Structure -
— iH ) = a? add A
line are
the dota lems
linear data shudoge
Is Segurnl€ Fok edamply e ore oy
In aa linea
hie ,_ the - data | lems
| T out "da och and =
fan las {ree s
In Seqye nes - Foz
{i ot -—

=
al
_—
[Page No. |
[oa la

EW irae -
Eomee
LA data Stiuctuse. 15
——Qnd Stor ng dota - Gear a atgihed 4p
_ Qe
the Second the
oe a
e
ile —
v

Any dota a{zucluge Ea . to


| Ofganize data to Su, 1b Q Spe fic psp 056 90
| that 4 Can be Geeossed rand or “with!
|
Lin applopiiate ways In Computes Ja samming 0 ——1
dota cpudy 119 may be gleched 0% C ) esigned L

Lo 5 tote data os the e


work
of s
pas log—
is
i
| on 1k
~onthb vagious - a lqoailhm - Dato stggcluze
Q way of Collecting” ing.dotain
opese tions —
[.

I sacha way That


on {eee dota - in an effecLive

23 ] Classification of dafe 9 ote

Ptim five 0nd hon ~ Pim bve “in{o Apudure


Stud hat ate atomic Ge: (a led
The dala uge

ue - age integer Teal; 0nd chore Cea


|i gam lec,
ed ufc. thot ave pot alomic are
k | The data ~
| Called non — ntimilive [sR 4 (em posit e Cam ples ote
Reonds Lag day and odting : KY
J

~ linea dala
i -

i) | past and neo Struc fu ae.

In ' |iiieg d ata struduze {he dala ites are


Qrfang in a linead SCquen(e pe example Gleay -
J
In nen -linead “da ta - strucduee ‘ + dat ta ilems
in
a ir not Sequence + Fog eam s {trees and
azaph-
I:
1)
|
| (Page No.

BL_jL
pate
.—
| — re
— 1 ==

— —— —

Q alot note on §Ccuf=on. oC)


2d sile a ——

plocess In which a fundlise + calls iteetf ell


=> [The
| ot indirectly lo Caled tecussion 0nd the Coseespon ing
Konction ls called a fewasive
. ‘
fonction
} .
using.
1 Xecursive algorithm Cecloin 0 eb lems Can he —
®alved quit Casily eAamples of such problems ace
—Yoosdes precedes | poslioedes DF5 of qtap pete.
CB Bewasive Lrction Sojues AQ paeticulag problem +b
Calling Qa Copy of ileelf aad Solving Smalls
Subpgeblems of "Ane “ion. otigioal peeblems many
mete pecyssive Calls © Can “oe. Generated G3 dnd
whe eguived - =

oo 21] side ~ & 8host nele’ ef on polish rotation -


=> Th way fo write qulimelic €xpiession is Kun as a
inobabion: An apibmetic expiession- Can be written in
[thie diflerend bub Cquivelent netodiss |, i-€. without
| Changing the essexe on outpuk of an expiecsion « These
| notolions
aie — re i -

a 1) Tobin notation - — oo
we waite egpfesSion in infie polation -€y: a-b+c,
where opefloss are used in-between optrands <TR
js
i €asy fof “us humons lo fead ywiite | and Speak in
_ Linfiz_ nobetion bat the game does pot go well
Lwith Computing devices - An algesithe de pieces RET
——E— 1 notetion (ould he di Plieult and Costly in tems
of
| Yme ond Space Consumplion- :
t - 1 ~ -
Cm T I XI I
k 1.”

——— — = = = - Wa. —_—

i) | Prefiz notations. waar eg] Lew |


= [Ta this nolalion , opesods 1s prefixed to optrands. ive.
; 1. Operated “is waitken ahead of. operands Fos example, Sm
ee I” tab. This is. equivalent toils notation a +b.
em Prebix notation
dg -- “alse known —as polish notation:
I 3
wil | Postdix. notakion: of Zot
— |
? | This botalton shyle_ is known as fevered Tlpolish .
notation. |
| Ta = his potetion Style ; the operator. is post ized

TN
to the -- operands ie ihe . Operalor’ is writin
| afer the Optzands . Fog example 1 abt « This 1s
equivalent do ibs iafix potato a tb
amd = —
Define queve: . ea

deletion
.

isa
f
lincas lisl cof Clements in which.
— [Queue I
one ed end called the
Can take place only “od
1
(an {fakes place . at a ~
8 {sont © and inde dlion
eas ~Queues ase also Called AA
othe ead : Called
out, Since the fires elements
ROS fresh a last
the iret elements in the 19
ta lhe Queue wilt
In olhes words, the ode
—.qQutue’ SHE feo "
in a queue is the
{ in which elements enler
_ a ¢:
OFdces in which deeds they leque - 4
x - el
eit
| i. ~g.4 2 & A
§ | EYE T.
T dlde<llolselzol C
I fone.

queue of sie 6 with Cusfently 3 elements


This is a
I Queue 1s Called fist in fist out (Fro)
»
|
* Tnserting o in lhe queue.
s | 2 3 & S
—> | Tea = Tear +1
10 [3020060] || \
| -a4) -4 L
= 4 =bo

:
Deleliog {tom Lhe queue
2d BB
eB AE 5 5
Pat = 6eat—| —

= [10] 30] 20 _]
pe
=
I
—————

. | uese. ———
24) | Waite clgithe la _inseleo and ddelion__in_gq


1
| Tnsexlion In queue olor

selon. (Rect. MTA, Jon, i


= i
oy i Step 1+ If Rea -= max=)
pte "queae ib gee
2 |
> Ey » 4
=
> | Led
2 I
| owen: 10 fenkb=-1 aod Rear=-1
- CO
| Sed Lront = Reag=
|l
IE
else

Reqs = Reas+ 1
!
“8

-— I acl
Zs [ed of if
X |
+ Jed quede [ Res) = tue.
) Shep 3

) | spep 4 1 Eaik
I
~~
=

Deleon io quese algo


x
ndeine Liat de |
u t =o L oo fu nk > Qears -
EET 1+ 7
wpe Queye 3s UY dnd tg flow
else
Jel val ==_queae { foont

NE ont pf =

——— dob it]


Oo
a
=
. I I T I T T T = = : + < T——

25 Ex Explain Typos. of qu al et gL IB

Polostty queuc a = my RR RLS TH


— Bor gene ate well dala Slauchwe in Simulations,
nl | pattitulaty fox _maintainin gu Ou seb of fabure events
COsdesed by Ame 80 hal wl Can quickly
— gelive what lhe neat Lhiag Ho happen |
=> [They base called "Priory _qutucs beceeuse they eoble
yea do pedmieve ems neilke bi the inseelion Hime
ai
NoY. aka Camelbe’ malch by which item
has he ighest Prioxity of yelhowal

2) Cicadas queue ~
_— I The Q77q ngemenl of the elements Q [ce] g(1] BE ole
Ifl fa Q (ealar fashion with § bh) following al, n]
= J
13s Called Ci¥cglat Queue. J

—= | Te lat pede 5s Comected do Twst nale to


Lmake a citcle.
—> _ Tovkially Bah {pont and yegs pointes points +a
| the eq Inning of the amoy. ZA :
| TF is alo. known an Ring Puffer"
Bi [owe] ]
SS

26) | Defiee Agee and its A pes:


= A tree data Shucdwe is defined as a collecky
lof Rhjeissg af entilies Ynown 05 neces that
law, linked dogedhes do Fepaesent hiesagchy - |
LA Wee data Todpaclume 15 a4 pon- linead
| dota Sthuclyre because (h1 does note {ose in_Q
Sequential maanes. Lh 1% o_hicsaschical 5iruciuse Pe
Lads elements in a tree nEg assacged in ey
maltiple levels . Tn the fice da fo Stucae, the 7
hp mot nade 5 kno 05 a Tool pode :- i L

ea Fach nade conkemns Some dole , Each node gentainsg Hl


_- \ Some dala and the lial ox sefmence of atres (7
RY | rod Ahab Con be called Childe Cae
| gs : — +h

— a
g => | Types af tree. LE

SDN
: i) | Geqegal dee a . ’
: F—~—
NS — Th ereta) tiee these is one moin foek 0 ad Seq,
Pp Number of child hots age nat fixed in Pach fe
_- level: ~—
ny
= ii) | Bina & tree. Ey
dl — Rinaty fiee is a Caco ination of one main gect dad =
Fs the pumbes of Child noles whee the pumbfy :
7 Chid notes is fred ie the numbet of chad
lpotes 1s net mote than two at each levels:

ir) B inafy search tgee


= Binal seatch tee is same ab binagy tree ye
1k is Qa Combi natlon of ope mdn foot and
| diffegent child notes where dhe number of child
hetes should hot be mote tha n tuo at each
evel . But the different 3s hed in cope of
(pst left child sheuld be Smaller thea “lhe
sect nds and The Tight Child Shaild be qter
= 1 Han the molto Tot at each level. ~
] ze ©
EEE

(Page No.

| Date
— :

|

25) | Waite Ghosh notes on Application of Queues


=> 1) |The most ‘welul . application of queues is the
Simalaton of a wal toosld 9iuclion_,30 thet it
1s passible, to undessta 0d_ what hay ens in a Yea]

wold in. a pasticulay Siluadion _ withaut actually


obsevuing its OCasbente :
Queues QC also Ve sy asedal in_a Time= shasing
i)
Computes System where Meny Users chase the
Sushtm Smal bancausly .
Bequest the Susfem - To Tun a
ih | Wheagu cy he WAS
plogfam the Obemabing Spm adds’ the
paiticalas J
end of he Que of the jobs
fequest Cab the.
Cacitiog to be ee caked -
na guess i$ in the Solution
add Anathes ane tol opesa Heo
J
Seasching oon -|inees
of p &hiems Thucluing

Colleckion of Skates
finding a path (Ang -
Queue 15 hed {os
J
of Graphs swAT
breath - Coroh ~ 3ednch
Paga Mo.

[--
Data
rm p———r ==

ine 29) iste algoaiti fon inserlion and deelion in quae.


a — |
(a | Thee ton yg ma UE e al Tosi bm,
emf. Angesd on [Rear mat, Front Du |
cea Sbep 1: Tf fears max” then
See. - write" quewe 15 overflow”
yg | ' Qt Bien 4.
I— | Le of ke]
L]

| otep 2 Tf font
= -1 cod - Reat=-1
Set front = peax=0
| else
| et Reas = Rear + 1
(ed of i#]
ER

I Step 3 Jed quedt [Reas] = tum.


Step 4 1 Eaik.
ee DR

Neletion in Queue aljesithm:

I Delekion [ Cyont fear]


mE

Spl t xf fronk =-1 on front = Qeas


AN n
Lg ie Queye 15 uUndes flow
else
LE

Sek va) = q,ueqe iy

{sont z front +1

<
LL

(End of if |
Fn

Step 2: Ext
1
| = —. my ee res
eel I I
T JI —

= as) al Explain dpa ab a dade Sra 25]


(E— — : —_—

=) | Patostty queue sa Cini NE ra


g es. | pe queue age sell i dala Shue in Simulations
— pasticdlasy fon meilang ©i seb ol Aubure evenly
| osdeed Vb Dy Mme So hal. we o-quickly
—— Sebtive what te neat -; “thing Co npc Toe = i)
=> |The y base called “Ps ory" queues be ceeuse hey emble
\ ITN = — hems, nei lles by 1he inSestion Lime 1
|_Nnos L mathe’ match hy which em io |
| has he rv Diioxi ty of setrigual ‘

) | Ciscalas queue
= | “The Q¥angemeat of the elements alo | q nm Gln iu]
Go a Credlar fashion wits €0) folowing Qf nl
is Called civcalas Queue. ¥
—> || The last node 1s ’ Connechel to fork wale to vl
make qa cigcle
— | Trdially Bath faont and yegs pointes, paints 1a
the. 5 inning of The ama . ta :
-
ol It is also Known ay
J
Ring
|
Buffer" -

You might also like