0% found this document useful (0 votes)
94 views16 pages

Data Structures and Algorithms Overview

Dsa Notes

Uploaded by

Arnav Dadhich
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)
94 views16 pages

Data Structures and Algorithms Overview

Dsa Notes

Uploaded by

Arnav Dadhich
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

Date I

MON TUE WED THU FRI SAT SUN


Sulyect

Sgauohing ecanique8
equentic aneh 1
Btna easuo 3
A D
osting Techmiques Bakic Comeehts
n hub.b.le &oxt i 6
Seltohon Sot7 10bon)
S a Sot
6
meSge 0 9 5,2pRRORQ 3
00d Sost 260 28
wo Ceunttrg 30ting alqontoms26

6 in b

PAGE NO.
Date:
Date:
MON TUE WEDTHU FRI SATSUN Subject:

Subject
0 Senuehing Tochmiguas
0

Asqusnhiat o liua keaseh lneas Acauch slepl 3b8et ue1,


ao 00uled aSequtntilseQsLoh io
th &lnplatBeasohing algozithm Sep2 i n thun go t skp 7
Im ma seasuol ue ima tuaveue the shkp3 ALIJE hin gako slep 6.
s t Compluklymd malelu elumnt
Bht i t uthh ikar ohae looaton slep5 t Glo o18kpa
e ound hn matth i faumd, him
sttp 6 puuint elomunt ound at ndex
90 skp ond
h Loahon s thoe etusmed step+
othesuele h algotmn attuoma mull puntl eumint lvmet oumda
lep 85 ext

o 23 G BAa keastch
e 15s|2olas 226a DmenlComeleih
fos(-0 iin; ltt Best wase 60(4) hun daa:/eA
Catij== dala) ode wovst Caue OCn) cohen dala-13
Duntt c glomamt _ouwnd t d : t )
a
uak
mo. e aseS

00

paintt ( Bmint msl found");


.

PAGENO.
ON-MLL-01--@PEGASUS PAGE NO. 22/C
Date: L Date: _I
MON TUE WED THU FRISAT
Subject:

Subject

P dalab0
Binauy Seaoh 4 hinauyScaueh culgoxtthm
wed fo 4nd H han U mud
Apeoipie alue Centancd
Landed Aay
S

wosk on hediido amd ngueg nonafnle


Thiyala.oithm Aulelat as ta daBa
hsaikd m- ohom at
Tweks buy slaung the seasch_en th puntdata s mot puusent
middl ha ay t h media
Value àlouweu hanHu Huget Value
#hat mansthat the Acaueh neeols-zn go
higlnes imot hn meecl to o0 Binau eauch Cam, dala)
h thedesctmding postintdneas

unay Seasoh ako Knaunm arn d hdle ( r)_


Aa-ntoaual easualh a mid=
ogasuitarnio 3eagah
daka =s a Cmd 1).
examale a slan 2 rehutn md
na daa =s9 else (dala a a Cmd) 1
Sol mide H midl-
rmd else
Cases T daka == a Umid). + md+
olou-a a Cmfd S
L dlata a Lmd S65 &HetusmD; 0200 D anas Hat
OOL 6 6 6. dala met
found)
TON-M4-01-PEGASUS aC63-69: 6Ana
PAGE NO.
PAGE NO. L
Date: .
Date:I
OOOOn
AMON TUE WED THU FRSAT SUN S u b j e c t

ORTTN lecHNT QUES


Subject

Buhhle Sost_Bubble bost 6 a basa alar


end=y,mid=t ooeauuuging a tuing mumbe u
set begl,
Sep (a)amd epla) otthu elumimi L n t u CoHUct Guder.
Sepa Repeat Sep
enal and Pubhl ost is Huimalut soing algorithm
wwhile beq =
a Cmid)-Lem bat wOHes yehatedlyutepagu
Sep3 ttem aCmid ho
set end= mid-1
adiacomt elumenta4 0rey
Bey a
h uWstng der
else do Exah A146s
Bet seg mid+1,

set mid = Int z i be


eno pas 15 16 6 8
Slep
wwgo ep a

sep: TaCnmid]= item 156 S16


Pas2 658 1S 16.
set 6 15 85 16
Loomid 6 8 1S S 16 S 6 8 116
else o A G8 5 616a n 5 6 8 16
Sue 8etLo UULL 5S A h S68 1 6
6 S 6 8 1 16
t sl
Skp:6 exit S IS 1 b a na
pas B8 6 ATA
6 S A16
0Time ompleyTt4 (ti6 5 8 16 n

6 5 14t
Best lase OC) hun doba:

os wOst (ase? 0( Jog n)


Avg
OT ON MI 1011 @PEGASUS PAGEN0.L
Date me omplexa
Best Cose on) (aloeadu
Subject
Subject

ed
Aug.Case
OC),dsUndte
& e
&ave
coee
o
auOne n de@nd
far (o n-1 ) idu
(iTnses ot Tnseuion bort a kimpl oig
algoithm a t The Osoy
plit Lntb AoakcdO n duno¥ed i uttual
yálues om msnted Oat Jaxt.
placadat t CAct hostior
Alacad Cudloked od
AC ACi+1Js paLt
tn he okkd

A m p e

2 Plog==0)
3
budak np-1o
a thm
slep:l Repeat sep 9 ond 8 0 Ri2o to =n
Slep:0 set i0 4Lo mp
skp:8 Repeat Ohile E = N-1-
CExe cule pas 21
a) Th DATA L{1> DATAC{+17 Bun emp 2
uah Daka C,Data Cit1))3
Tend of i43tuetuse).
42 61
LEnd of innest foap 2 6
Cend of gkp 1 ouhos loop J
OT ON MI 19p:@PEGESUS PAGE N0
PAGE N0.
Date
Date:
S u b j e c t

Subjec Trme onplexih

aBest0se o(m) aliusdy 4d.


Cae Oon) andi
wost
f Case pdersndng.
Rmp aC iI;
seloohin at hu selucton seut alttm
ehiel izo aCj]> kmp) Sokta4 hukd,din
akd1,
mini mum eelmmt
dh1 mini'mum
m nntd
aLin] atj) beginmhg
patk aonmd
p a t ina at thr
o 3 4 n=
aLiHJ kmp;

3.
2
ePlothm
Set S aloJ= -
fa 3

4. Rehat ushile Temp ACI


a set aCi+1j atij.
mae esnnt asuood

cOnd s leop]2
5. etA7+1) = mp
Lend o Skp-2 JocpJ
HOT PAGE NO
ON MI 1011@PEGASUS PAGE NOP.
Date
Date: LL
Subject Subject

uok Sentsaulck Sot is


hioks an eloment a diud ard ConguEL a
puoADOMn
fos t-o ; fina; tt) hilet ard pai
he gaOn QuALTd u
pau hiens
nt omin= 3 þicked t
msed
Small aaK
unen asgortm
&t daa do
a r kaCmin])
A lasige uay paxhhimd o uo aus
in= en e Adi tValug smailux
P
han thL pecedalue
auuayhelds th auueg Asualkyand
Han
Qngtheu
the piet
Value

Suoap (aJ,
aCmim)
shdt
piat
F 02 3
0AHaorithm A
1.Repeat Skps & and 3 fos k=1,N- ghaut Shd Chake punt elemut
C l MTN CAK, , Loc ) ba
CB) hke tuo Uauahlu
3 Tntes chamgACkI amd hCLoc 7 52||o bent t amd a
u Aitratudinp
Slat e Slelt eink tot
Tnp ACK 4 9dtenk fethe
AUK): AlocJ A 16|sl2l1 losokte Value at left
ACloc)= Te mp end s ham Pist mole
Staut
CEND if slep 1 locp Gkte alue atst-
exit quale thamprlG
Ine Complexih meve lokt.
Pest Case 0(n') 7 both depsse oest
O

O0t ase 6[n2) cuit.

HOT ON MI101|@PEGASU&'udnt innel Koop s


olg M t n PAGE NO.
Date L Date

Subject
ODOD Subject

AgsthmQuick CALA LB,0B)1


T 08-L8,ten
ROvtiion CA,L, ub) Relusin
Cend i
QauGt-atl7 3 .9
eett PP¥#T
laut kb CollL
4.CalL
(aLl
Quek CARR, LB, Aoc -1) Sot
asHhon
LB, 08) CARR,
end ub, le4 h Lt 1.
Cnl Quik CARR, Joo tl, uB) LSsat aigut ub t
uhile (Staut end)_ 1.

pict).
hile Ca Tstavd ] Ptaoi thmLpasuhhion (aus1, b,ub) _ Autusn Jro
O8LB CB thon
Sfauttt ext
while loCend7 >pivat)_
3 Set Pvot ARR CLB) set fst ekm.cnd aPat)
end-3
. Set bM= L8 t|0P= Ug
S Ohile DNKEUP do.
3 ohde ARA CONJL=pfvet drpead
ctast fend) set DNDNHI
Suoah,(aCasd7,a Cend7)5 Cend0hileOr 6
8 Lshile ARR Dp3 2 prot sepead
3 9 Bet UP E0P-1
Suo ( aTA3,aTend );. o
1p ONZOP, hen
e u n end, Time omMexihy
1. et lemp ARR CuPJ
ARRCur)=ARRCOU Bestor Avg m lg n)
aniok Soxt A, b, ub ALRCDN72Hemp 0JO% ase
b ub) End 73
LEnd While ine 5
19 Sed ags LR1 A LUP).
lot z asthhon (A,b, ub);
ueh soxt CA, b, foc-1); AoTCoP)=plurl
13 Aetustm , PAGE NO.
wdk Soxt CA, Ao071, UD) 5 PAGE NO.L
HOT ON MI 101GPEGASUS ititit
Date
Umin) Date:
Subject: Subject

(VO Meuge kat Mauge suti The kohing eohmige dne Meuge Sok (A, Ab, ub)
n dutland congIex jecnzue
and otiet
&osting algeathmn
mid (btub))2
Th Subtitr a diufdad again nd again nt nesgest A, b, mid) ;
auies n i Hu Lst Cangk be flshes di medgesaot A midtl, ub);
Sakd Pmesige (A, h mid, uh)
bo 2

meBtge (A, h, mid,ub)


b
1s S24 B S 20 mid+1B
Klb
A whle (k= mid R jk=ub) esp
SS211
aCA=aJ)
A A

elge
5Is|2 bCk) 9T415

3
Ktt
PAGENO.
SHOT ON MI 1011@PEGASUS|35|loI d a 224
Date:
Date :
MON TUE WEDTHO FRI SAT S

Subject OODOOD Subject

Hal 9or A_Soxhing


pamaing tu dala agitm fhat wok bit
be ed
whle Cil ub) bnay t ntb dseh
called a Asoh
ma bget Valug at the op of the tree
a he Compue binay tsun
eke A5 90 a20T
hide K b=mi Sep:) Tnserut elomumts n a
hian

0s Ck=Lb; k= ubiktr)d AA 2
30
a CK=bCkJ;
3 slepi
sep:0 Insest naay
Agothmat 29e 24. ) al
Int (amp.legihy
A3o 203
Sepgs Noo, dulne Cve elbmtnt a l
both est hua atuwnugsoot nocle alukta
_wbst a 0enlgn) amdatmmbeau fakes te aot nedes po
A) NoO ea suwamehem

becommlk
PAGE NO. L
SHOT ON MI 101 @PEGASUS PAGE NO.
ninitiniiiiii
Date
Date
Subject: SUbyect

kpy) Repeatglep3 15 ow ckack

beponLs 15191 20 ISIS20417|


I23 Neud Check o
Sepsakat al Lo mocy au
aOady htahited.
huay
4 p+ au
modu
otd Chek or 9293
auLOy 1ir20l30

4s oln) 10omlplaxip e amath IOs Aha tu becomu


oudiud
ollud 0 ca mmuttod.

oHeil Muhad huahil ndhad b elun na AbLO diloßon uou


sd ughose clhit uds _au algaa.d
honhiled be sstomd
Bat '
ho cmID be Lomhlelebinas tuLL IsS30 h o 20
a hekare4
eath Luel hu tu
PAGE NO.
PAGE NO.
A
Date: Date:
MON

OOOOO
TUE WED THU
FRI
S u b j e c t .

ODOO
Subject lgtthm

Mgr
heahlhuAn) NSERT HEAP (Fee, N, iHm)
int ox); Aa CAdd mo mode to d nhalhe pb)
nt 2x I+1;
8et N- Nt Pts=N.
hile (Ain 42 ATLbALuget
2rndthe leahin insedt Tremj
lawgest- U Rehaat Gep 3to G whde p -
g9et PAR =(PtRJ) e0ahon at paunt nade
TLIeMTyee CPARI theni.
iotget

laugar= 0 tuecrba) temi Qnd detusm.

1PTlasgat= t).
Sucap CA TaigestJ» ACT) 69et aka Po [updales Pto)
nA,a, laupt)
CAsionThm d the ootat H
ho Sat (An)
or "h ,i stL-) 8- kahuymo 49
eahit CAn,D

Suwa CA 3, AC3 Si
OO Max neoh CA m,1) PAGE NO0.L PAGE NO.
Date Date:I
Subject.

Subject 2
2ea Sot LHgo).

DeLHeAfl -toee, N,en) . Bulld a hoab H, uing nesthon J.


Reheatos J 4 to -4:
Aemoves oot of h. a
Bet denm= tsee1 =N CkemO veg loL
Call TNSHEAP (AT,ACTD Cend af leop).
2 Set lost tseeCN amd 4
mde_of HO. gort A by Oepeakaly dolohing he root of H
8et pt Ond Loft =9 d sgt 2 Cnho:
ihe polnex usn elae poooidusie.
Aepeat skpc S while Rsght y Repeat hle > 1.
Jast 2txee Clet and last tsee LRi Q) Call Delheap iAN, e h
b) Set ALNtLJ= LTeM Emol oflsop).
et t 0 Cptou= lat and Restusm
CEndot &tauehuue).
ehi
totuo LRpst tu Clet 1,then: Mege

T ahe Bet NA 4 MB=4 amd ptu=4


Elhe ip LCompasueJ Rohat ile NA <Rand NOAS:
s0t tnce Cptr sua Rigtdt Damd TANAI KBLNBI, hem
Riglt ( LAssien elamont Aom Atoc 1 sete TetJE-
Cend o iStoucoe Luhdak poinkua B pta =pfs+NAENA-1ALAA|-
se
et Aopt af pEy dnd Rant Rlt+ a) Rtg0 elomyt {om_Btoclset CCptsJE
CEmd lep u oop)
t E N Omd Lost Atree CleH) ( [uhdale yaintess ) set _pto ptsy+i and NB=
hem, CEnd at1staiatusa
9t C Ed ot loop

PAGE NO.
SHOT ON MI 1011 @PEGASU PAGE NO.
Date Date

subject CBicket zat)


Subject
1 ladk sant
9 i n uwmaining elommts o c. ounting st TE mat a bmpnsieasct
NA AHon
Hofuatfos h =0,12,
S-N9:
Counting Sost asable Sting
Bet b Cpta K3 =B[N+k J. Lgedto &ot shjet eegzding fo he
LEnd elop key
Else R-NA: TtCountu Hho umben s keuy ohose Key alua
Rouak tos K=o,,2, au kamt TháS0ting kchmique a eleehie
SeE p t = ACNA+EJ
ushon the diumasGu diout keuz a
LEnd hap3 hat So aif,otheywise t Can houcase he
Emd StauctsD Complexity
Spas
6 1 9 4618 4 la 12 t2 y1S1

heue m-11
kClaxget elemont=9

Co unt CacrI) ++

s udale tho Caud away 3


O 2 ys 182
Cont 13 1C|to|1o112 12 | i
Nou-haoetteokhe getal
CcumtLil Count Cil+
honsC H oka auua4 Count Ci-1
ly uhdak Coumt auuay
L
ui be uwed
PAGENO.
OO PAGE NO
Date: L Date
MON TUE WED THU F

OO OO Subject:

Subject Auuay to kd Asvay ime Confacthy o Locp


Stepsckpa) Jn 3 a k
posthisn ad-the elenentat loxt
prahem N*kF1tM,
kp b ge o te index of uhdaled Counte
whn cqual fo ue Aast 2lemnt
u ipdattd uut sot OrTat ofthe
Aocahtm e a a Cmmt n Nole pplyma of ut.ak i s20tcable cahon
a n nsoed a a loo
Deoutmamt by 4tho Aocation amd
n Coumt asuayK=l000) Hhat
Aa ti o00hiorv MOams ma pladis aufng (O]a s
k elamemt
729 1302
2 8 A
pdalay Cumnt Radik Sot8 Radis Soki aa non- Campauakre
12 Soting gntthn atKased to
8as the elala D dehonasy codet
9lo 112 13 IU useg doumting &at a a ub slouhie to Sot
auuay o ntegeudatt dig and
Qumaly Soun Chataele, thasaeks
t oC4}Ú-0,
Now he Sooted Array> br-00umt Cori=
ULOL 2

Copy the elments of to the say a

aCi3 bcil Coumt o o e1


Coumt2|451s sI4614 Lol
CoudSot (O,,k )
530 090 2311432oys7oos OS8
R glep
slep
Stp PAGE NO.
Ske 9 PAGE N0 as 2
Date.
Date:/_
TUE WED THU FRI SAT SUN
Subject

Subjest

N
Roulik Sast (0,
u l ehum
z max elemen-
COut nt mos get max CA, ).

Tor (pos= 0 pos Xlo)


o 2 67 9
Coumt Sot CA,n, pos)
oOBO1LSo231/18 /ous 67 os 70
6
23
-fas-
Couyt ot CAn Pos
Skepl:
Slep21
1E-9|1e 1Ilo 10so
upbked slep 2
d StepH
2 3
| on loy-ss |090 199 22 22 530 67
Tnteunal &eunal Scohvg
Qi uwuch algoxith e uwed lnt a_
ndom nleed List with min timu Comdtxy
Adwambages of arauuy aneh Sequembal Seaiel
1V Qexpkain ith_a8ilab exdmpl the
puinonlf 0peAabion o hsop Sat

-ele- PAGE NO.


SHOT ON MI 1 PAGE NO.

You might also like