0% found this document useful (0 votes)
39 views

Dsa Notes 3rd Sem

Uploaded by

tracowiz.1008
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Dsa Notes 3rd Sem

Uploaded by

tracowiz.1008
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Page.

Date:.
Lata tauctw
_and mathemaZacaL_MEdss
JT ASthe Laqical dato
ata i Aho
in di
o dtping VAnd01gaiising elfieient acceA
bhodiuss
mediticatiesn
imked lii Stack ques, gapk
ahh tarees
akhcu aees e
Basia teminele
hta -set ol ualues os alue
Bota items - HelAepite
impleLunit 4
MaludsL
Recehd-Calleotin data item
-
hle Caltectub ecohds ne tyhe
Sfohatiens fo dota dtouctuke.
seanching edig menginginseaing
deleting
ARRAY
A data Atmuctwhe which. can be dolned d
nita det_ofdsimilas_elemtat
Page.
Date
pen
play

6 30
Ceclratieo ray 4GB
30
32
datatybe Name-aahauy LSizeJ 2 L ,6,3

int Clo1 Boe 000


mouy dize AnE_eleaent.Siuc ¥ element
2
Adus=_bake.addhuut_(Kelatiwjndex TSie o Arsa
HOOO + 32

upper bourd

LeWes
beuna
dl *_LLB -L+ D_
22 Amoy Loumw
nt ak lI[);
KDmajo hdeh

2
O00 01 02 02
12 13
20 21(22

o base t0
Date

bade adduLs b, Ai a0nch ellmt


OudhmXn locaen
UJ
( (2 +)*_w+ e enbade
e
o.c_elements
lunent
dbntng r1
)* w + boue
li-)*n
8Xu nde Aantu eith
A matnix a wg lecati
53un p mjos 0hdo._nd the
UCO ard,Vedch ellment
Al21[391 d b merng Calculat
ocup
0cup ybyte luo
AMay Ln byt

4000o
ddhu (125)>u t (3q-34)) * 4
(8 +) y+ 4000
yoYO
Page:
pen
Date. play

Loss Taiamulas Moatix


2 3
A13 Qu
23 Q
3
62 LC6 los

Ads a LilljTemeat -asead +/i +-1))X Z

0 elemEnt_

loo t 2x3
2
2) 4 2

l00+ 2) > lo2


A matax odie 35x25 hepukenteda as pu
majmdde find. he adld' aJ2o whu
mdankaix Louss" tatangula matix and. base add
JsLoc0 fsumingsi of Blerent w: 2 byte
Addhes
hooo + 18 2 2

400o +19 X OX 2
O00 +3%a
4380
o Asst_eluneat (oo it+
Page:
pen
Date: play

ftucaddt-D H-
Ainomut
Coleimn Majos Ods
aNol
Spahse Mataix m A

objjct mad mxn alues


a dat D
th thetiu ha
eelumns, the he metmk
elenent olledspanse
dO o then Apakse
mast
it i rlla
hau
malmx
O
6

X or [mXm
column.9,jo hds
'A
Base.add No.oelementu belpA h pelumn
qeuw r
d elumentu Vbelu jth
No Lolum n
Ak
an a13
92
Qup Qy lyg| 34-2 2

ln-o) +ln)+ hi-)


n-)- lo41+ +
Page.
Date
pen
play

nlj-1)- y-2)Li4)
2

Add-B.A tnli4)- L-2)NL-) +l-4)*p


Aivantage ahue matx
eseh memotu Con
be_LLAed-g totage
2 taaudind dn_ull taku Lis time Cemputnq
tibaë
Kepuentalen
linked ket
Aray Rep 2Dahha i_Used tohepksenta
Abánse atnx Thu' a 3 28u namedu and
OLu,CEAunn andL value
Tdex oET-uo element uhure Wu U preeNt
COlumn
nked at
dnthii each
hep-
0 ha oueld eU telumn,
Value, NeZT NPdL

Enll
Date: pen
play
Linked List

i hemeqente
Calleclign ala elemetA
Ca dnedy Ned cerrhins iue_ fakt
s
Lala_ and Lnk_pan
Qthchad ith Atho
neNEL
NLdL athiA ned ,
athchad_with ne nduAnd dA Bn
at Mede Centains null_A_0 ponls, aa
hityb od kepeseatatien sknOutn
Anu_lialy ie o liked lut
uaztion a Mdei
Stnict Mde

int data
Stnct nad ink
losntes 2
ode ned
Head Oatd Link
>Rata Link

last Sata
LImk
ult,
Page
pen
Date: play

empason in ist dod. linked lst


Aduantaq4s
oinertbm and . delcin
Lkach
oOC) tme
Ods inAhe_
namio
caduanoqs
Ranclem ades elenents ahe_nt bossible
0MLumeL Vexta nemoye each node
Kebresentation_lanked lket
Node Node 2 Nodi3
Head 50 200- 41 200- yoo
200
Cyoo
6
otaTfo link&ot Node 4

Nae1 50 200
Ngc 2 300
Node 3
Npde l6 NOLL

p Lnked. list
Simbllnked Jiat
Lohy Linked List
3Cinoulhh Lnkeddt
Page
Date:

imbly lmked List


Linked Let
Avoay
hsesten
Aeltie
OlO
(n) o lo)
T ning Oln) Oln)
OCn)
Cliinas} Oln)
Elemetaee
acae mumoky
iseet
O Cn+m) OCn
oalt
Lel-rekskentias Stzuturu malloc Dusic)
TEnn
dtmuct Ngde
nt data
truct Node *link
Stnct, node haad.
stauct md Stnict nodI. _
ad malloc (siz otruct Modr))
1de = (stmuct mode*)malloc slze &tauct nadle);

had-Ank node1
el2 lik NULL
net .data 50
Page
Date:
pen
play
PEhead
headl Likl=NuL)_
PE"" P data)
P P Liki

Stock
LIFO (Laut n Fiyst fust Bp)_
Out)
AA
uhich
Cellediin o uneak
element mc be Însented
clata elomenti n
deleted
enl af_ene end cdLMd._ tho dtack
dtack.hicipl LIfo Last n
_an
hixst Out),
The ellmet Jnsested last hudtack
that elhment_deleted dizst em the &tack

Spuatiers Oueciated_with tack


h
Pep
h-E LA UAed te add. meu ellment wn the
dtack_at
check th
he imu additien, Lzkt
dtack mot
th -dtack iA kull nhates a_ehon
messaq dtack ow.

e- i wed te delete element uemdstack


At the tim odeltien ist_chetk
Page
Date:

dhat dtack emph 4 n0t


dtack_u emph nnatL PAr
meAag
pushL

Stack
i euehlous
untf U
etutnj

else. f
puint U\nenph elemert );
tep p+l-
Stack top]=2

int
piuintf ( Stack. Lundealew')
etun-
else Pitf Poe-ped. element)
punt td", Stack. Ltep);-
tpptep-
3
Page
pen
Date. play

displaypning_alL element
Ltop<o02
disb) else
=sizuH)
uhils ltsp
puitf nY.d" ,StzckCtep] )
teb top43

Aink Rebrsentatior tack Ztnud node


NULL 1000 stouct rede *unk;
eb tep, neo,temb i
Ned oNuu
Vew (struet node malloc Sgg[stouct.
:Noder Ltp=ENDLL)
PECUeter element ");
Sf TY.d
new
em ;
dataelement;
newunk =NULL:
top = meo
ALelb),
newdatas el. ementi_
mew- mk= teP
stdi'b.h> Page
malloc realocCDat
Callec

(tep == NLL) 1
pAlundulau)
elke
temp teb j-
tep temp- link
LLu ltemp)

Lplicatien Stnck
Erpwin
(3-u)' 4 (5/2)nrs
Ezp: lolish Netatien
ei =Kevwnse
KastDin Ezb pelish
+ - notalier
0

+A6-

K un NIR
+A64

tABC
Page.
pen
Date play

-lb+4) 4(4 -2) 2


-(377ft-72

2
-++ 34-42
7-18E 12)

7
3 NLR

tru -7 +34-42
LRN
34+ 42-
C -LP/ET E) *B)* H
A+ B

E
-
A +B4 K ¥8) H_

A +*H
Arf
A
Page-
Date.

E
nehehatons

min+1) OCn2)

C8+) 22-- 4-7


3+2
31+21-
2
Page
pen
Date: play

A+[Bte- (PLE T P) *6 ) *H
A+(Bc-(P/£Fr ) 5) *h
A+(C-( PEFN/) *b) h
A+LB C¥-{ Ppft/b *)*h
A +CBC PEFNIb *h
A+ bC PEF/b *eh *
AbC PEE A/b h
atb (C/dte Nf)*[a*la-b) -b)/c
a+b lc/d ef)1t) * (a-b)/C/c
a+b* (C/def (ab-)/c
a+b* Ccdep1/)*
a+b*lcdef11A* ab-c/
a+ b cdef 11/ab-C/¥ y_
a+_bcdef 11/abe/*
abcdef Rt/ ah-a/ ¥X-
aa bcdef1/* (ab-)
_bcd.ef 11A ab- *_ /c
/C
abedef 1t/*ab - *c/+
Page
Date

(+) 5
dunbal Jtack PastinEzp
3
3
C 34
34+
31+
wwITP
34+5

(3- 4ts) 1
ymbel Atack Past ézp.
3 3
3
34
34
34-
34-6
34-6+
3 -6+
34-6tt
34-6+
Page
Date

jothia Se)

emLw
Vabenant
R. and hepeat dtep
d to 5.
Lomes puh
tetok
letfaanthesia push te tock..
n_P
n_P
Ple GbeatpaOLk_ncountexed
, "ttetack
o shesatos kamAtock
pep add toP
ame highut
0ach
i hecdenu
btd te dtack
ught sauanthuis Pncounteud then_
Da) peb' kem statk. amd add to P unhl AA
ccu 5
aanthis
b)heme Lut rhanthus
eit
A+8 C/a_ E1f) * (A-8)/c
pnhel Jtnck Pestiy erpxehon
A AA
A
+ Ab+
+
C ABC
ABC
d +C ABCd
+4 (/ ABCd
ABCDE
+* (/
AB CDE
+* (/
ABCOEF
ABCDEF1/
ABCD EP n4 /*
Page.

Date.

ABCDEF 1t/
A + ABDEF 11/4A
ABCDEF 11/¥A
+ ABCOEP A6
AB COEFTT*AB-
Ab CDE F 14 /*A8 _4
C A6 CDEE M /¥A8-

ABCDEPA /A6-*C/+
Kecuhapn2

Jt un Lint n)

n=1)
heznnl
else
hetutn(3+ unln-1));_
Uoid mam D

ptd n ));
nt act liat n)
n02

tukn ln)
Page
pen
Date: play

etehmume how manuno tmes that


beubgDHnteOL en_ thi schii

hed unl lint m)


Unt L D,
(n> 1)
un (n-1D

2
Cenaideh the C_ hunen
WeLcd
gT[irt n)
25
uhunn 35
gut In-):
q n-3)
4 DL6)_June being Called n maun inuekahoo
huouo
Then
bule
hm ill th hncdionbe
LLÄyM he maim
Page.
Date:
Cueue
FIEO-

vebhsenátion
Hoay
Lint x) 1
inde.e

Peueshll
lse Lkand:=r=1)
_uRrd ent
heas: heas t
Lue.lreas Zi
el +
heah ah li

Leil dcaueD
i/ Cueni=gak -1)
bE Ne element hqueue ")_

Lent-beas
ven
Page
Date. pen
play

ent ent t|;

LinKed
listhebheentatitn
Raar

thuct NedL

mt data
Jtmict Med "dink
TYT

dtanuct nsele neuw=ktaut nead* mlloc She e


Stauct hedi)|
n data
Lent t
ent= ne

Tea unk Nu
bea = Na
Page-
Date:

Circalan Gueue

a0
l

Clhe
th

P
AAe aN=2

deoueue int 2) t
UnodzLes
else LAand-E Deah)1
Lert ent
er ua -
Page
Date:
pen
play

Zhu bOlousng Docti ezpuien with ing dngit


ehendot
ohehdnts enteluatd Lng_a dtuck
62 3 /23 y+51L
Nete that LS thu Lzpenertiat apekatoh Thu
fep 2 element shuck. alteh the hat
NaluaT Q
6
5
32 8/6
D 6

m
nen-Lineahdatntautus ne elements
Lennected. toofh in linla mat_
Jerminetet-
Rost-
No. nedes at hegtt h
tetolne d ndde at heighth 2°+2'a +
alzna)4/)

(n+1) h
log lntl)-h 3

+ 2 (n+1)
Page
Date:

Pmblit binan re

OCmplcu

thick
loee is non-embty Aet_ene element
D the
lignated odlt_aof_the toetuhil nen
LumaLng- element Ahe panhitèn late
empb et lach uhich s a_dub tse
Hect
|Sefrih- oa eol length o
the path
the eet a the lnecde
Hoht nad a lengut_ bath
em thet nele to it 1Eaus', Height
hepht
2807
Page.
Date: pen
play
unaHy_Lneg
9munol
2

a bunAHy n
ThLu_Lach aan hau atmect
childL AADLnaky txe eith tmpt os
aruit _ncl Calld. neot ttguthuie Loith
hinarty tees Called the qub ub trez and
Auht dub taee

LL Node-A nade hauimq ho hildhen _u


Ch001dleal ned o/ e2etnal node,
Ablings - Zhe ehildrin of the same paHent

Aub-taea- ny medla o_a taeLith all it


lecndent a ub-taez
knblata,_binany Tree-Ll Luls aemay
compleiely
nay-
ilhd. "exupt_last eulit
be Cemplately _Jlled
Page
Date: Den
play

Frull bina fe
_Ach nd ewu_ luul Aheula haul_ mazimu
erhs Le itdhenld be_Lamplli

may nel_be_temblt
ee|but binany taeu may
alL cemblut tae ahu_benlhy tu
Kpudentatisa binaky tP
Aeuential Rep. fiiay_Rrp.
Lihked Dit Rop.
nedu
Dkqenta 2i+ 21+2

2 C2i)
Page.
Date.
pen
play
touct node
nked
JH/Matz1e{tgt Atuct nare
*zt;_
100 10206
06NOLL
NDLL NbLL
nt dataj
300 2 NOLL WL

2300

PRE- ORDER
IN- ORDER
OR DER
TaaNsal_
PoST-

PRE-ORDER (NLR)
IS,,9,10, 8 12

8)

(3
3,7 8, ,S,1

HO, 20, 1030


N dehLNR)
urdng chdes

3,5,8, 7,1
Page.
Date

PosT Ondu (LRN)


LO20,0, lo_

5,8,9, 3

Audods L to kiptt)_

3, &, 1,-
binoyseahch Tre
taessal bnahy taez k_
huhestpest ordus
LRN
pet 8,16,1,Y,3,2,3,
Thu_dm hais LawAal qme toee
(2NK
npdn 6,Y11, 2,5,1, 3
Th huight o tha ten h hu length
em th
eng
The foihé
path
hu
2
5
he 2st_any
bnuy te i - bal
Page
Date
pen
play

binay Seanch Tre


Ropt aluayu uates fhan
i Llt child_and
malles thak ught_chitd

nataucluen bma4 Seahch Tree A

37l, 18, Q, 5, 15 2
n0. leels
t hulitd
t8

Eleter o nedu im bunlHy_Aeasch b2e


kta Nad

nolstmutial_quiua n pe bina?y ree -

ascemdui do
Page.
Date

Zelziien b5
1:Aeaich te be drliid lelete
dea hedn_uLete it_ t
nedd the nedi to
has _ont child Lne Ed lore

39ed.deltud._tes itasent inked


bel child pl by pnss thu neol
the hlo chldhn th
L Stzato
Stratg
ed has
4 Lto placz the data. data
this_data tLi
uit
sught Pub reu g
the mallut_data dub toe_anad
anqust adata ltl that
hucusaliuely dalte
nede

26dUt

e
X 82
3
31

(
Page
Date.

,dhch toee 4 genihatud by dnesttna


htegn
hi plleung20,580,
rd
50 152 913,2 ho,
2pt a eLpeckiuy
t ttts

38
58, 15,20,21, 32 38, 50, 58 60, 62
50)
15 (6

24
Abinak tee.
eahch y ed. te lecat_he
Sne Y3,which o thu lelloLsBung poreh skquenci
u_pesibl ad whithaL etexphin
152524,11t,2, 13
2-3, 50 40,_60,3
o, 6 S 31, 4,3t, 43
3161 52 14, 41, 3
177i214 (
Page
Date:
play

AVL Tee
Balancuactoh tis thu dtnamghtgd dul
heght
t Sub tez_aHa
Ihi- hel<+1 O2
B.P L-

LL LL Rotatud

KRRetahen

60
LRRetctien
(30)
(34

KL
gtat vor

-
Page
Date
pen
2 play

LAnstaucta AVL trees q the quu ky elenett


1,3 d4, 20,A, 72 H,2
BST
Page..
Date.-

AVL Tre Rotahen

A
A

(B

nstnut AVL treo o olleemg4- kuss


Ruys

40 11, ,21, 31,2 18


1

4
Page.
Date.
pen
play

23
A 33, 55, 7,93, 5
Eemet 112B,L 8,25,
2

NRnoa
3525
8 2833, 5-5,-
NR
Page.
Date.

22)

bunay_Heap
Max hap
neal s lazqeh. than
both _chilkun
cempletu bT
at
Krpusertatien x huap

2+T

2
4o 3539 2 2231 37 21
Page
Date: pen
play

T 36 o 126 237 3|22|

10)

+
+2+ 4+8

+ h-21
h
nsehlbn m_max huap
14,3 12, 5, 82910

42) 2

T nlsg (n)
Page
Date

eletien

Otnlegoa
Holman Cocdli
hixedlength ASC1
Vaiable Jength mes
Chadacte

ebahd o 25 0o8 016 008 0 03

0.32
asLndin hel 4 02 o 33
C d y X_ b_ a
O

T6 O 24
X b C
0.8 (01E
0-
Page
Date pen
play
00 X2
X=
OLLO_ XI
O 11 XI

bz LO

ng Cede length =
I2
Page:
Date: D
a
Halkng
a cascheng neuhohk hith On p2ud

dane ane ulumq hash untien2


hakhing technaues2

Zizect hoshin
Substacien methad
2Qwum method
Leld shilacq
old belindbhy4
6 gd ertachen meth
aouahe method
ireot basting
H)= lecktin/ drdeex OO to99
H L1o)
HS)

-0
2 hs tha - Hk) : o
k- 7, nH d
XSD
H lo) z 50
Page
Date: Pen
play
nunon_methad_
Medulak Auun
M=KZ1o Lecalên_hmdet
>memey

126
6T3
12
92
oayaisct

5eld beundahy method.


23
6 +26
'23 26 L6
DeWse

6 t_etmcten methad
HIK)= K,2,

Mauaxe method
HTR
ma alue
Page
Date

Cord K 51eelleq
dteheoa
Ku
hash
has table cénuds the
ard bHeucthu
thaLaraten te kky
hcchding4
AHLK) 5)irect hashin
z_KJ4
3 HK
H[K)= K 2 10
= 59 7 Jo

2HK) 59 7,9

3 HK) 59 1. 15
(4)HLK) K-8 59-6 2 51
HIK) H(59) =
59
which. o the olleuting duitable fash uni
ba_ a ang chbins_ LemLte l00
00
2) H) =
21HOe 99 +
)H)= (7+ ) Z 100
) [K) (77, l00) t+ |
HK) : N,(o0-+1)_
Page:-
pen
Date play

2 13 10 20, 5

Ipcale iku med l1o)

Vellsen gnate
2os dilehent Ry hash Aunc

|Sam lecatids nhmbes


Cellisuen_Keselutn Technuauu

Ouinea abung ecatuorv


AGuadrabic Kaekng Hash Table
Hash
Chaimu
OLineak Lobing
42
i L2,2

213 1020,525-
Quadh Pupbing
HlK)=(K2) 2,siyy ln
13, 10, 27, S, 23 o

12

+23
Page:
Date pen
play

Chamu
o 1o20)
12
1 23
S
6
Page:

nit-5 Date:
pen
play

Lpaph
a Cellecten aOhtiw anad tdgu

Abte edaes
eaqes
ilis
nedes
lenplet gpnaph
(n 2)1 2
n n)
3(31) 2
2

4(y 4) 4X
2

opneAentadion naph
Hdacency Matnz
ActA oceoc Lit

TNode
AB
A
6 00
D O 0
10 Page
Date:
Dlay

A
6 C D
A D
whendpnue dala

_0J

ddjaanc4
0
kist
A C -D
A
A-
spac Lublizatnern

Lnaph hauensa
uiting loch and eueny_ellnent_at
kast _ent-
OBFS Bheadth
t deanch
DFs epth Jinstseahoh Stack
Page
pen
Date: play

Minig un 4tpaoninq_oe
LpAtex zn
Apannung yee=witput Lap

ums Hapsuithm
Kuskallyerithm
un c a dg4
1+t4+S

++3 t 3+ t)t S+7


24
Page
Date
uskalAleo2

Sub part c
aph

You might also like