0% found this document useful (0 votes)
4 views218 pages

Sorting Algorithms: Analysis and Examples

The document contains a collection of notes and examples related to algorithms, specifically focusing on sorting algorithms such as selection sort, insertion sort, and bubble sort. It discusses concepts like time complexity, Big-O notation, and the efficiency of different algorithms. Additionally, it includes various code snippets and explanations of how these algorithms operate.

Uploaded by

aboodabood57x
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)
4 views218 pages

Sorting Algorithms: Analysis and Examples

The document contains a collection of notes and examples related to algorithms, specifically focusing on sorting algorithms such as selection sort, insertion sort, and bubble sort. It discusses concepts like time complexity, Big-O notation, and the efficiency of different algorithms. Additionally, it includes various code snippets and explanations of how these algorithms operate.

Uploaded by

aboodabood57x
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

Subject Date No.

Table ß conten

(1)ps ayoladl Tntroduchjon


omfiinyAnalsie

(2),aagladla Gamles ah comflxiny


Analysic
3)a,igalal Ekamles n comkxity
Analysis

Soria Algofbijac

(5)poiiladlta selectien Soyt


Fasenon Sopt
Bubble Sort

Aetge sot

N F B
Subjcct Date No.

Binary? Seareh
Tke art one

Clb) esy yoled! Binar? Search

(12)aaoladl Gieely Ayar:ehms


Hea Sort

l4>eyaelad Human cale


Totrautien ko
Grahs
secial tyfe
o! Gralhs
1Z)yayladl Geih Tnfenehtakia
Grah Trave's at
shoYfest
Subject Date No.

Dijkstres Alsarith

TaPlogical sort
+
Linear lime Sorrirg

N B
Subject
Algorithms () Bisladl Date
Matmaie

what is he meaniy of Alorithms?


bconluatled

Data sirUttuYe
J aA

feblen
Alyot
A
Algetiah Algatihi
Subject Date No.

Best solutian oß

Al! of Them is a Solutlon

obak is e setance bekucen Best


Aud Ffeicent salutian 2

That

Constaht wt
Date
No.
Subject

bwe said tha


in Ab St'act anney

So, he measur mcut a tine in ah

S Tke Prayamimi Lahyuage That

eficiewe Algorthn

Haw t0 decide which Alsorith Have


The Leact oct
By com ainyit with othey situatian
an by othe orls wth other CASE

A That Case is The Worst


lCase
Subject Datc No

Refresets
An)srunnny
of The Afyoritlen

The ch) Ptkn% AAnihe Yunniney in Crder


af )2
wiun

Big-0 Mota tion: Te Alson:hn That is


Yusanin

The worSt Case wil net


eXcecda)

E B
T N
salutise est
Solutin
e
em? Te inwark AHow
to
Case worsf
the thaA lese lite tess order in
Case
«rantee wilAgorihn Atri Te
hotation little-o The
Date Subject
No
Subjcct
Agorihms (2) aalal D:atc No

Hew ta Camla the order (The By-Notatioh)ol

Cansider Te allniy amles:


eAla ColhsitautLime

But why 1"?

Tte cansi tant Staimew Eeach of Thcn


Taßes os Conskikakt
Tine to lae exCuted
AnlBecutkc Becauss
we daW khow
Ha tks Value of Tay CokStakk

Sum = A+Btc
Avep Sum 13 cz

N T
Subjcct Date No.

oBack To amles

(asb)
S t S t a t ment
else
Subject Date No.

4far (i0h)

forli c h)
dse

Heto wsrkinTeon

n:n2,

N
Subject Date No

ate

Lago)

As asement ofe "As an Ctt Cele!


Code" Ctt

lagcn)ll
TA we eorite Te Pre xamk
Ctt ole

Cihy
hete so The st comix3

N OT E B
Subject Dale No.

GSor (ion) 0cn)


St

if lab)
for Cio-n) atn) On)
else

chcose The MaNmiumNamben


betwecn em

Lools l be eCute

fo ion)

N O TE
Subject Date No.

etesi

Alyar:n
Base Dumber of Stat meht

N
Subject Date No.

Samo EhamPle oh Eininy Tke bi-0 Wattin;

if azb
for Cion)
Sume en)
else
Sum odt

Th Bio isi olhexln,))


Subjcct Date No.

O while li ty)

Skatmeut inside rhe loof


te be excutele

L How much cn)?


Subject Date No.

ila b)
farlion) axCnsn)
else
for (io’m)
for (io k)

Lor

Answer in exemle
(2)

N0
Subject Date No.

lcoo, by considerm

m) bceones
constnt
aBia-Os On+k)

Cole segtment of cade

for fionyta for tio-)


st

0TEB
Subject Date

Ta May humber

Answa -

arr

Maxarrol

N T
Subject No.

* Sorting Algoith ms:

inserfion Sort
O simPle soCh

Selacion SorE
tysime As Timllenenteian f azl)
Lacald be writteh in Any rogpamminy
Longeuge
2 £icieht SoTK
Quics Sort eherl
Heaf sort The Bigo
ALSicient in Th
Kannen of The Bi2-0
Bubble Soft
Comb sort
*shetl sor
4 Distibutian Sorh
(Linest Soting Buckel
Algothns )

T B
Subject Date No.

atesi

SoltingAlgoritlns dalfesentiase lsebia


fron ÂNZ Ohe TY Another

WHu futs Tu sans Cal gor

orening what2
FoX Eimile Mumbers
oY orderin? umbens
B&scd what?
Ta Base oh. Cam farisan ( álea)

Alyerithms js Te number of Comiai's oh)


ButTSW Tu Big-o lor comlu Th
Dumbe o Statmehts ?
True, But Here e Stet mee iS
ecoalaisan
N O TEB
Subject Date No.

eliscende Basel an Tke Tee froblem

There Ae loo Tigfes Tnternal sortie


af sating Algonitbms
Based onhe Are in Te Main Memory
ecatian of Bcukinsy Ekehe soring

Are in the smemaeg


Anelather Pacts ih
We will Styply
ust Tk Tuterna Sortinay Algoribhms
Th Diseribtion Sortino

Aumber of (2i9its Nmber of Items)


Date No.
Subject

O5eomanAlZ

%Te cam Panisan Cormiares Pe whale Jhem


’But Pitnibutian eomlarcs By pDigirs
Biy-o is Basd on

Jumber
of
itelns

(4) N O TE BO o
Subject Date No

oß insetion Sart with O )

A Anshwer: T Can at Coalae bekween


Thembecalse Tir They Ape
Workie ih oelfeteK way

Dktrbuton Radix

EPfici nt
pbblk

B
Subject Date No.

statebethsh
)SePtion
) selcction
)Bubble

MergDln logcn)
Te Aars Tanee Alyotithems Are The Pandemenl
Alyoritams Por Fhe Pacter Sortin?

Enst

froblem Size
Main Resene)Th Do Meed
An ektra deute Strucure

N 0 TE B K
Date No.
Subject

APlaing Crablem
OBfoblem sizes if The

Cah be Handled iesgale-)

Dan The Otker Algonithm with Clnloga


2)EXra Data Shrucure
The
# Neebs Mate Data siructure (DSA
To Run,An Tee ExHru DSA

Salt,eg:dHuge Prabem size


No
Date
Subject

Q wrte sdesi an Alyorithm to Sort h-humbers?


( 3 foins)

O--- slecxian.

nsCAton
selecaion
2 Melee
3Quics

tatst'sTs
inselioh, Beeause n is snel
an if h dta is Sotted
become Och)
seleplon Because 4 is smal.
N T E B
Subject Date No.

wre An efSiciekt Algerithm for Sorein nehumbek?

ipa iE yeou ehese TheKerge "or Qick


Justi ies L

Then i wil heal male DSA Bakel


an MeYye ar Couick ort

Ansluee
inserion

Selectioh aLiy DSA

N 0 T
Daie No.
Subjcct

Bubblesort Jl

los'e

SPaninnn ree

ate,The DSA Beauines Mere Tim

DSA

ysy DSA
Gomtleke
Dihary rec
(T0) N 0 TE B
Subject
Algocihms (5)ayeladl Date No.

outlines
selectian So lracingY
Comflixity haty
ComlerisSian f
inseltioh SorE

selectian Sort why?Jo Bun on

cale teaflate <class item)


Vaiek selectien Sort Citein a 1,int n)
for lit i-o;i<hel; itt) co(n
Srore

iall< aEmin)
min
Suuallati aLmin]
Datc
No.
Subjcct

How Tk selection Sort worss?


sclekion

ill select ake min Velue Lor al, i'S

After he selecioh of hcesed item we SwaP

Jhen we

Te Belation shil between sota and nsorted

in cach stel The salted increases


By che itcm

thitle We Yeach the"n item


we olent hale bz Slepit .
-whye? Bccase, e hate allea cheoseh

iten is Already SePte


N E B
Subject Date No

Note Th iiiny fiocess Doss lee

wediide HohThe Same AYar

Thre Are he in 0tem


firsr
Eou PrababiliresAscending
Order The Ha irem
Jby using sdeskan Descending, O Th Min item
Yde Last

irst
Awe il Trace
Tu Ait one it 4s wi be

Commehts ohTh Olei:

i s n - ) why n ?
Te Last oil be Alrealy sorel.
No.
Date
Subjcct

Te Unsa>red fat

To Swalit , And bec the sote Payt is Aet Alreey

we Suasel That Tie' Pist item is Sorhee

)"j<n'whu

N OTE
K
Subject Date No.

Iracin Cansidef The folwi Arrawi: bb34.2

Pur ir in FAin ositín

nin

Unsortt
Size:o
Ain.
in
Size-4

aIj7s af min]
Sioal (as:1, aZmin)
6s5 Salsc
alilsa Lmin]
mn: 2

-tE7ar
nin
Subject Datc No.

min 2

size-l

swall atil, aIib])


Swapla III,alzl)
min 2

allsal2l
Sortel Uhsotr

break
too

T R
Subjcct Date No.

Ahase 3 2
min 3

al3]sales sal (alil,aEtmih)


Swal aLzl, ala3)

N:5
breas
Phase4 i 3 3 4

min

4
swatlalsla)

break:
No
Subject Date

44 kalse
breals ta outer Lool

Bu, ele are 1We Ceases


of Swafs + Bii-02
Asking oabaut Big-0
Cuset slecile Ceuseeeg:. Satin 6 numbens
Answel

irems

NO E B
Subject Date No

Wost, ANarge and Best Case Par Tae seleetheh Sort ?

war's Case Bcst Casc z Av Case

NThkYe is o Bst or Av
SaY
why The code wl alwayse be Yunning even
reotder
t tak Somc Tracwy
Best
selecion Avg
Sor
Date No
Subiect

InseChoh Sort

Lscesle
Fentlate Sdeta iterm
Void 0nsertion SoYtitcm 4L],in n)

for (int il, içnit)


irem tnm: ail;
ParCint-iD S8 Hnsafj-1]
alil a-11
Subject Date No.

warks?
SuPfose Tleat
The first Elenent isAlready softed
Atote

Selection %inseCtion
Sort Sort

Th Egseement
is Relerselly is ärbitasily
Lar Th Min Elenekt Soted
we sler Seurzh in
Element we Hele

Ab Pur in ies faoe


Pacr
Te Last lenet we Hae ho check
is Alveady Sortel about T Last Ilenent

Value of Last Elered


NO TE B O 0 K
Subject Date No.

CommeNts oh TheCode

why
Brcause le sullased That the Lixst Aemet is sorka

To cheekLor AlL emeks


)" temf: ai" 2

5)"acil ai-1 swhye

(
O N (I3
bteulsy
=FEJse 5<3 ah
220
tner The 2
ofEnel 2
=2 2:- Phase
breaki
1) 5 And O70
2=3
23
Siees4 1
Size1
Sott
1:1 fhase
3
6 omberss Sollaing Te
sullose cim Tra *
No. Date Subject
Subject Date No

fhase 3s 3
1 2 4

2
220 And <3T 23/35
af2lalil
3

130 A s2

aIjtm, 1235

(14) B O
Subject Date No

b'es 5

Phase 5 i 5

breaki
Best, Av,nd worSA Cases Fap the inseTkion?
ßest case

|nsertioh
Sort

N
B
Subject Date

How Tà work in Tze Zxam ?

insertian, bec il the itens is Sorkek it


A

Cocct
Q Giye a case which e Sele chiay sort
is betten Than Jh inseYian sarER

ailingsso which Al4zaxith sdecis


The Max af Min Builing's(items)2
nitoms then Stal

T B O 0
leal inner ofEnl
fulse salted
}; jwaR
i]>«] if
j--) izi last (int For
ruei Sorted
elit) Jast)89 izo,(is Cint For
h-ls last int
false, sorheed bool
Cirem
n)int allBubble-sart Void
itcm) <class kemPlate
ajiladl C6) Algotithms
No Date Subjcct
No
Date
Subject

How Th Bubble sort works ?

Ta iclea behind Tte bubble sorE ic hal

Bubblk
*Sorting The biESt Erant
Babble
4Back

Bubble sot

D
o Bubble sort
The Main Ddea sto comlate Bekween Tavo

TE B
Subject Datc No

Si Ple Tiacing far Bubble sors CNai he Colel


suffase ou hale tas Sorh_ (5s2, 4 b,)
Phuse
L62

57 4 =

fhase2 L245.4

(254.156
N o TE B00 K
(47
false bewll
le) bool Soted rhe_Play
The Lahd
Btttate ttit Tenolerabias
iterate inyswaPP any an SisThele Ad
Afer sarted Alcealy is
Aneag The
suplasesThae sort Bubble Kal
sort Bubble ioe
COThe
Phuse
471-T
eRns rue tes4sl,
6)5)
Subject
No Date
Subject Date No.

Acommehts on Th Cele

sorted Aalse)hy? (Tle inher Leaf)


Make any auafPing alerahian Then

N
No.
Date
Subject

5.2,4ba

fhase 1 4 o
Solte ast o23y
(5,2,Lbt

C592, 4,1, 6)

5.(15bs 2, 4,
phase 24 i21
Sotte
476 F
s2,

B K
Subject Date No.

Sortl

hase 3 i-2

Sorte!
2
3
F

Phase 4 i3

Sort

Salte

iklask
break,
Subject Datc No

*Best,Av and ansA l8A WotSt Case far Bubble sat


+BSt when Jee Ae Arkay is
Sorted OCw)The inne!
Bubble ’Bg-o
Loop
Sort ANy Cuçe We Cant Comiute
The comtlixiey very wel
wost Case

qh

bect cdAe cses

Best Case
sorted Avg ca[e

o suffase The Peu cole Cin Page )

N B
Subjcct Date No

2) whais Tk BiQ-0?
if The Array is Sartel the Bie?-o ik )

Cuse

3) what is The Best Algorithm Anong Tlese


Thee Selestidn
inseltion
Bubble
inserkion Sort

Aa k Algotithn is sialee ta imlese

The selecxlen is Alwagse o(N)’So in sELdudel


o ah insextlah A Bubble sort ha
a Best Cuse swhich ohe is better?
Agieers, Anel liele Tee Boioota is Sisles
1 Msertion
Subject Date No.

sullase 2.4G) hat is The Big-02

A The Alethm Sortingy the mhulobet in.


Asceninsg afle
But iE The Alsoith Satking Ah Aunbers
in Descending aley Te big-ois OUY
Thete Ae seera Techn:que far Desigtin
The Algoithns such ase
OBrute lalce Tg AL Passble Solutiohs

Branch And Bouhed

Shars whar we

16 E B
Subject Date No.

k Pivide Anel Coneluer


Houd Fo divte The frsblers
Divide -b lee onhinu on Th
in The Er Lide
Conquer

bcambine

Pude An conguel. Merge sott


Quick Sort
AU d work is cone in The Hard Seatioh
etge sort
- Fasy DNiston
- Hard Conbinakh.
- why?)

Quick See
- Hard Disizn
Fasy comojnation N 0 T

whg?
Subject
Algecithns (7)ayioladl Date No.

erge Sott

Lcod To ßeieThe imlem emlatih


ofergc soE, See
wWW. geelksfatgueks atymecye Sar
Stackceerladsca questiahs/s6224003

Kerge sac Algacthnk is a sor ting Algaitams


ar soring jeims by Sins pe Diuilane
-can werlechinque

Kerg sot And Te Me eahtique

Ocambine LRetgin)Tke sulbsalutisns Tag her


qs Same
lkiens subsa of
Ainel Tk
embeled
in salutsa
is sab Th
subsawtisn slial
Leopbak 3)luer Con
Al sbude
buselLauhiehis
usin
Tu
selectiah)
Sn To eCkicn Cins asSuch
uSing
subsoltians Tke
prsble Soluine
a For Tech Keroe Ousin
ofitions Thiee Haokswe,
ve
No. Date Subject
Subject Date No,

Sort Conquer

calnbine

Th DiMling Tech in Tze Mergp sart is


Alwayse Constant
We pNicde BsK
b/h Aar each subArray
Lpwhich is 1
Th Geecal Merge-Sor, kezP asiking
uhtil hln,But Rou Can Stapiv:in
Befate Thut inAny Jeel
The piin is Warking by ttä Uiiny
The ßeculkie Siruchle

Cailtiastl secol sublist


w
N 8
Subject Date No.

we canfate Ench susr oo sublisrs Togkber

-Tlhe comeCingg ofelatian is Th Sslubin

Sublists we ut it jn Tke iB Posihjan


In ThPreviosi sublist

e Becursivy conbine Eeach Tie


Sublisns Lmeile we Beach TheAein iSk.
Dotes
Gneater than ) or ess Thah<l
Con ner Skel
Subject Date No

2- 3
4 5 67

R
4 2

3
nl2

,
4<3E Then Gleak etr Than 3
Subject Date No

5 6

X
3
3<4, 7s4,7 <5,

3457

NO T E B
Subiect Date No.

nle
3/2 -|:5 3/2-l.5

5
?
Yesta on
Lo Be The hav Te sane acst?>How
L The Psesat Bequire An Extle DSA
Sos They Haye The Same KoSt

TA ohe sf Ta subkst is Already Sorked


Can We just hot to

754T49
Aliea
Sorte
Subject Date No

Main BeAGehs.

Tk Sealistkich fakes Hare casL

Case SEylyi

74 12

olnlagzla))ohg?
Duge Canguer cambine
Conquer Con bine
But, we lone ha make oteThere is
cny camla'siens Best Cese

Bestarineg oleration
No.
Subject Date

AsuPose The EianPle in Paze ,if in Jee


Before ast Step instel af Storing in
Anray We heel te Store in Ae eue
Stacs, nhe ist
wiltil Th Same CoSt ,ess or rete ?

Notes

Pselacaesg

N T B

Here So[t
K 0BO T N
combne
uen tGon
Divide
Basel Alanithm ting Sat isSale Quick
ah
Bescces: Lallowing Reliew
Te ae
Sort CQuick
Date Subject
No
Datc No.
Subject

ADiuide

Th ist Bå usin n2anel That Was


Ca cohs t a n t o r a Cs Cases

Quick solt
we ivideHece BaSel on Some
Value

The fita is arro] (Te Aass Eleneit)

An Then we stlit The lict


inko wo i t Basedah The
Relationshif between Eleneu aal

Element
in List 1 Rivar L) Element
in Sublisr 2

NO T B 0K
Subject Date No.

Sublis 1:
tess or sublist 2
equal (s) GreetelC Thth
Pivor Pivor (z)
But, Ha) To kne) cither Te Eleehts cle
ess a etel equa
we Hale to iterate oh LyArree
kyow That
LHa much i takes2

adlelh The Alseocithm


in The Aleths
Loit shoull be Embellel.
In other
wores We The Alsorihm
wil usee Teat Vot an Ehta
ikelatefar oPretin
other hinsg tathet
thun ciiiny B
Subject No
Date

ATiacins : sallose Te Folwineg umbes To sar Tem


(7,4,25d3,1 ,lese)

23 4 5 67

last

tast

So, beauSe le q is
Than fo we
biger
heeto
a Place To fut Tee q
in Tze secenle sublist
Bur whet is Thet Ee
Rlace?
Tle fasitih af a
number is less or caualL
Subjcct
Date No

a2l&/31lo)21
457=E Jast 77
tast 277
Slwal (q2)
SwaplamTart zI)
Firr tt last --5

Last
last --

12
SWatlz,)

3s7.7 4t77
Subject Date Noar 29

2143|12e9

N O T K
Subjcct Date No.

IÝacihy 2

25T

42)145/8/7

3) NO T B
No
Date
Subject

ast

bleas

Pivot
6 7

B2/14 /5| 7

321 4 5 / s6

12

374/5
Combihe
N T E B O
Subject Date No.

CRuick sor! is bettcr Ttan The other 2

in senesal Case The Kerge sert isbetter


Becalse oe Dakt Have To a iwDorsE Cease
Bather Then Th Gick Sort
Ta Guick sart Haxe a wost Cuçe
whn Tke Aeray is Solted

Buk, iF yzou Have a Case whee yeol can


derermine The Pivot

Te cambinin sa oetatienis exsier

The Biak ate of the Date


sos we Cah Eusilg Dxtehdine

T B B
No
Subject Date

Au e choose Te ouyck sart we


Hae Te ett warst case which isOU3)

when lwe choese T Qiick sort2


i we Hae infar matianAbauThy Dta

Base on Tey Aost BArequentlg Krk

Sorine Te unbets kinAscehdin oden


As And The Alyanthn faks Tte Largec
Auuabecs jn The fosut Al Tle Smalest
Damhers in The Back.

chenged but hat Tatall?


Date No.
Subject
Algor:hbas (9) aioll

* Binary Seurch ree e.

StrucUre

Binar

Twa chaices chly

TLe CraPh, whts is The Bran

Grafht The Gralh is


ef VeCiy aEdgesi
sut Th ssehlial Pact is The

T BO
Subject Date No.

GYa Ph

GraPh
Laa GraPh an LeaPWade
The Loc i I0S a Wode
reletes, to Xit sele
B Dilfes AromThe Cycle

ah
Pact Does Wat Exisip

N O TE R
Subjcct Datc No

AGalh

owh? T we sat in An
ndieekl ode wil bacs sto
Gcalh tThe Sract and The
En.l ele Are The Sane)

in aned dut The_Aade

Gralh

lat cipale Gra Ph


Bu, iis a GraPh Has
a aycle
BO TE NO
-Co
ectedl
ngk
connect
ngl
lwajse hiecal connectel
Joconhectel
Cannectel Weakl
beakt isGralh KThis
onneate!eaakly
tedh
chocises Two
GraPh Direckel
Gralh
Date
Subject
No.
Subject Date No

Gralh
conncctel GrPh
Ubolictl Griab
Wheel Gra?h

Unloheit GrePh
Thy artafh That it is
lges Doest Wat Have
a
wheigee

%Comleke Bilaite

Th Gph is
Parrs

-Th Gafh is kide

colori sLystcm
(6)
No,
Subject Date

Biireckiohal Scalh

am Tais Brafh

in Th Netuwatk
ABale Calalutexs in

f2,3ht,5 3)

Page Wumbe
Not ode:)
Date No
Subject

+Thene ae chlimieMumlbec of GraPhs

How to conNert a 6raPbinto Iree'

Root Noe which_does ot has Ahay


farents
eah ode Must Have only ohe falek
*E Conider tlhe Prel Exam?le(i27sl,bE,3

ake Malles can be DutlicakesFin he

B B o
No
Date
Subject

loil encbienelThe Boat_ahel child Then We


Hove Naes Acom Grafh ko Taee

ote We Make unlimited umber o Trees


Pram

K How To Convert The ree into Binaryree?

Te chlls Aar Lech ade is <2 onl


EX (32.7l, 6o5, 3,3)

Thte is a de
eThat Hate Thrce chill,
Subject

Tree
3inary No

* How to conNet t The BT to BST?

less ehe) The Parehk


AndAlL Aade ah the Rislu ol2le
( ) aaeater Than th Paren
AlL Alades in the Ri SubTree Boa
Kake ohly one BST
EX,2,7sl, 6, 5,8,3)
PuPlicata

The
teltee Te Biglet
is Also let Tree
Atso
BST
Is Bsla Gealhe Yes
Subject Date No.

2o Grade
Lor The
fraject

Alg2atithmsik will Tahe era


Kake a a Bekken Brajet
Than hc olees He solll at

Simseeo"

The Braject sholA solue


ARRlicatian Alat case Shud
LHa ba get eal lile Af? Goagle it
N T E B
Dalc
No.
Subject

OR,Tere anisAnother choice hat is

"ou P:nel fa froblem that is sovel by


Algorithm anel o ofimize That Sa Solubian
a
Jay usihg Another Algzoithm
frojeet's sfeci;cations'
cate
Tk Cole Aust be ta orittcn by uSiney C++
il yau y?ou choose Anether freramina fang
ohak Th hunctiohs Thak ane sl
The Punetion's Patameken, Yetunel Vealue
al Tlemenatiah
to He a ask you
Bemote a unctien
write
Lr Aiamfl a Ean Panctian bake a ftmelee
bey reteehce
Ris fasel by netenee
in yau cale

cole 2 TB B
No
Subjcct Date

a bether cheneeto Ge ore Marks

StaCE b claiho [Link]


a Wand Ele
The semsren
triterisFy ame
The
Ta lins1 fage should cantailgk sYourMame
Th your TD
Th secondle Pasze
contaihs Th abilTable o Cohtents

-Th Thcd iage tn3 refahees


Lo Cohtains Beleeheesc
The Pollolcig) AREDot
zlelerencesi

-Sulase you wate Skack oelo

MTe seleaion sort is an Alqatth far Sari


a5 1
No.
Date
Subject

Th tarlien y-ou submitt yaur The Ineecr


More
More ou wil Get Wotes he
Ea Th
auNte e et arks

KTh B5T

The Numbar oP th lelel is =5

hene nshe Lesel nun ber


N
Subject Date No.

LThe ath
In BST There is ohly oE ath
PorEecchole

"Becsuse Tee BST Was


I Ahather oe buill Basel o gr
Greete Than or Le he
Boot

6-5-3-2 X
4-5-s5-3-2X

Can Wehaule olath starts Pram "3, whsy


o, Becase The SBST Stalts Brots The Roat
Subject Date No

Delth The Duwber oEJe Praby The Ropk


To a selc ode

Hiezdee 7h distianee Drom a slecilic ole


To The Boot
bin The BST Te Hiegh - Level
Subject Date No.

Koferations o BST;
Bil BST Srom Th Palowin lata
S34l,2
stach ram Sdesin The Boeh

Theh am Pate Vext elemeu

ahl Theh with ext Modes

ha anly
lef side So hay
and there is No farionng
TraVese To
fost-oel
olecThseelica
ire-oder
The The Talass
in-oree
arder sleaili in
IRaversels
Thseliia Delekia
BSTiaVers oonsolerati
No. Date Subject
Subject Date No

in-oroer TreNerse
L,LARClelteAelefigle

12 Rrgla
Bigle is

y In-dere 2 3 5
That is usel ro Ihlelke Gives me sotted clemes
in asehdina ofde
Jsnaw wher is Te Boor
Irordel The lef subie
htis Jele theq aseCt:sg Ayeitk
No.
Date
Subject

bLRleLeft-Rigle

Post-otdes

The Boot is The Zast in, olSer

Scapah

foande

TE B
Date No.
Subject

inserhon:

insels the Veue

wl be camleked awhg2 Dibcakel Walug


Deletian
frobabilits
Jhre [hree eheices

9Pwo child

Just elete the .deBecsuse the desetah woke Jed


bo

NO
No
Date
Subject

Ole chill

lek chill ade be in The Lele cie

And ie has

T B
Date
Subject

How Ta Delete Th Jede uho has e chills

Two ch;
olle chil
No
Date
Subject

Boot
E Consilerng 7he reu BsT,delete The

Cont

stilt have LBy Gaina

4)
Subject Date No

(14

Once he Cost is o Dufliekel

Taere is Wo auestion such as


"abe TaNesel alael Gile Te outlut
Tle autfut of a kYalesd is given to
an in Th Exaaand yell wil Wse it to sólue
The questioh
The cast af The Arale Sal is

(
No.
Date
Subject

* No Qiestiah S h as, al the elue


The & Gven Yee

LRealasd ucstian
The e):-avent Por the

Sote

delete
IraVelsal

Qhlert it Te BST ut is Te Root


Hh Th is aot Not Th Aiel alue
(lo
Subiect Date

whyy, seaech insert ad delete is ollogcnl)


Bacause We deceasibag Te lDumber oA e cletkichs
bt by weHels2 Gieater Than
Less Than

subiesis CCM)’wy?

oTetans
No
Subject
Alaorihns C02) brialadl Date

Greedy Alorihn

Th Giteey Algatit or The Gireedy Techeniue


Zois a Teshhiqlue Aarsolvinyeoblemo Tate
OfEmization roblens
Lpha isthe akinizekicn Rtaolem?
The ofini zakioh problen is ndin The
oPimel sabution And
Tae alimal Solution lfets(a;alba)
AoseAbosa
From one Case ko Ahother
JinothkNetds Zoat he Prablembut whyi
Jatc: Th case.
is descoibed
by the fecitication s. The olimal Sulukion
ol Tke roblem
Salukions

be heleht
No.
Subjcct Datc

Problem (equ soB tin) Otimizatinn Probkm


Rroblem
sotttt ot
Sauto sofution
Sletinh s(2) s3) Sofutioh

SoluttonAmony
Trese i The
Caleel Alzorshin
Gree y echhique

But 4ou?

But 7h Lcask Cestsk The Solutien

Se who detechiks deter mincs The cost ?


KAJote Tk csst heleot The Rie
in Ta Biyoit was The ine be
Hale ien etendent eh The case
eask with hakes bank sroaer To
a) it(ceehany to ea weAnl
Moncy Coxntina >
Menen
Recess Countna
ColHullhan
e
Alupstithy Greedy The
chaice. LoGrody
Lel Gast The
choic Grl Tk
detenmini
noy Biy
No Date
Subject
Subject Date

Lo 8y ahdicbdy choeSiha The Greely cheice


Lp The Greely chajee is The May

To Ansthe east

BankWotes

50 P
20 -
These Are
lo frsolosal
solueian

Ohe

50- 2o = [Link]

lo -2o - can ot Use Ta 2o

N
Subject Date

aso we Hate choosl The at' Breel cheice

osoJh ofimel solution wil be Te Xim nim_Mumben


Anel J Gree? choice wil be

he t ofrimal
hThh info frou: Sol'tion Amony
prblem Greely
cho,ce
Locul Souloons Globe!
ofrmum oftimwm
*Enods
Note
The Grely Algarichn Guarahtee
CAGtobal
offjnum
The leal ofimun
Buk ir Dese ot Guatantee Tee Globale Samin

Again We Hatea Grou of frolosul Solution


Subjcct Dalc

+Algohm
aclobal
choie offinum
Gtobet
Also

with The fo low'na catayodes


Jokron
Xhange 6 kron

'5(o= 5
B-7-tCan

4-1 Aly snsthin


Solution
2-11
T1-1O

This is
slaiaa ich is Gbkal
otBmun ZocAL
Ofime
Subject
Date No

Glabal oftim em ís
Globel
otmum

Rablem

pPtoblem Statlmeht, we head schudle the sruhhiug

we Hale bo deline The Cese to

Elerg Tmef * Tk Cagei


we chan aye
Th case

ThAlyo
Wen PrniriNe 2 orher Alg2ritoim
be ohange Does The iaces Buns a a l

in crese
Subject Date No.

Ex; we hale Three Alyocthm sto Solve Te cas


efined RgLohge<+
4sshor hesl

Time loret
lo

3 5 i s 35

34

2shot hest
Torel
29
Thtoatu
34
20
Subject Date Nc.

Better
lotd

20144 34
34

shartest + lonyyest >Faide T End The


olimak Salueion
Beause here An

solution which
isThe Bekter Algathas.
Bettee SHces suhe2 nds The
olimel Sallsls
Suhiect
Date

S HuPfmah colei

Camiress Dale

KCangid er Th fullouina) EtanPle


docx ite

Fch ektr is Reesete

b qd a
Eikellenghe each letter
which is bit.
Hoauch

Tke Human ao,le


Jreuts Tk langage
Basel oh lh lethers

q7b-3, c= 4,l1
Subicct Date No.

az56
b38- 24

x Rememben Tat we eed Comless datq


whe Tà Sale
stotagre

By CanWelEina The Befresentallon, cp! the Sial Singhe better


Peam fklenahe ariable Jehels cole
To
Th Variable Jeagde cele The better is Beirsentel
by ohe bit IaeBiThzec Bretc

each etter

oR

N B
No.
Datc
Subject

code Sram xel lehglt To


ConVettinay Th a code rat
Vaiable lengat uce foluces
oouel Have more Than ehe Meanin

Corlec
How to ltale a cade wth oaly che
Meanihg?

Detait
ext
iT

Haw Many Bks Thut T hale

irudas o 56
Date
Subjcct

Letkex.
Thele ais 4 chace whelz asigle Sinle eAke

The
Both
/s
Tà Have The canreat Nesuil in
Ekam

Hubmanl ihe nchar cIi-)

Lor Ci:1 koh-1)

&.RigleeQctex min ):

insert (z);

(14
BO N
onnCost Jess
so
Heat
Adtttye The
Tinel Cas less
CQuick Henge, Sort Bubbe
ainsetEion Selecti
an
ieat usina itcns Sarin Sort +HraP
emanDuynaical? Alleantin
Dginanicaly
Menat Allecating Aemery Heaf Te
Heal Lhatis
Sort: Heaf
No. Date Subject
Subject ) Date

-ok,wee to ise Heat Memat To 5ri in Sottina


togBiy usihay Binavy Tree
Lo each ole BePresehts a Dynamic Kemery

AComfleke BT
we das Kole Brom ahe Jelel ka Anather
in Thut Level

why 6T in Heaf Sort


LTo Manaye Dyhahic Menorg
aTe Aueil Kissirsy Data

NU
Subject Date

eh alatai Por Auaidina Kssiy Pata


How To Buil a coete Jef Jastily BTÇ
Lo consider The Bollowi Data:
2 3

b/94/2
index
Biglst 2AF 2J atay

Ar one biseal mele

(2
check O N 7)-7 Jaxtb
576=F,577-F
cklds
we
s Beteh 52T
at isole
check Le
Swang Altcn
.de aobills The Tiwsdhill
a) The
Lswhy
che Prst The
childs
beAust
in
ieheliny
ng
ax
scelin
Sorr JoHow
Datc Subjcct
enor Saldewhy?
e lo Beot TeDlele Then
acheck childs Tlwa hat
Pl,3) Stoa
deckel
5
(3swa
No. Date Subject
Subject Datc No.

bswat The Boat with the MoSE Biglaole


ih The Last level.

SwaP

f0swalllo2)
chelekelle) Maxl97)
Altex
Slwal
chect

SManl3.3) SLoat(955)
checs
Aftel
Subject Date No

ER522

Stwatbo)

25-FZ>k-F

Stoapl2,6)
Swalls2)
Jletela)
No.
Subject Date

tetete to

533=T522T Z3=F72=T
swafl52) Shall2,3safC32)
helete s)

56

N
N0
T
og/)) Case warst cASe se The
Alter sort HesP Por ’Camllete
Traci
OCloyl)) iscost Totad Te
lemehts Irelateoler Owhy
Subject
No. Date
lyocishnL.
Subject Date

tamah Codee

Beducin The tM aabeh

L Hals

B usin The

is imflenentel?

Lo ica kind

Eseh lebter is
Date No.
Subject

How Tae 37 For Ta Haffmah Code Builde

Te Bot c cluse te The Boot

To Kaa Less defth or Heige


And So be Hate less aber ol

O.12

Ho

E B
Date

Take Thse Brobebilirjes or Fre quehles(yle)


Lpfrom Kin lo Ma
12 55

EwYalf
h

5 12

los>bres
55
45
25 30

Cieate ewoe ExHract


Date
Subjcet

xow Bill The BT #from Starting fron Bout


Cwbich is biggesh Value)

tog

130
2

Because The'z" iE is aJale T t we


Have ben ereatedi shaul Hae

T yet Th Cade Lef sile Coles

other
in The EXam
is Jot
ConYeco
No
Subject Date

The col Por Eeach Letheh

e loo

111

Toral Tat
Dumber f'bits Mumberefbits
belore Hatfmanc

The a unber
al bit in Huflman Cle
Pao ohe bìr
Date No

AGrPh:

wbak is Goalhe
The GraPh cosists a! lWo Scti set af

Tis GraPh is en Uhclireckel ohe


Uniteeral GraPhi The Gnalh
is uhdicected wbe'a" is
leachable Brormb'
is reachable Peam

Diteted Qrafhi
eachable eamb"2

I "b' raechable Aean"de


es
Grath usieey py
eset ARlcatieh
Graph Geheral be
shola haVe.
to 2au
sekts? cast what
Cost? The awhet
is
Brathweiglate) irectl
No.
Date Subjcct
No
Subject Date

Gekenel Gr
LoTie ons Weighe teresents an Abstact Ua
-Ahd The Grah reresents othig
ARflicatian GraPh

Cost Theh reioeseks Same elue


Afor ExamlleThe bweighe in Te
Wetwatk Gath
Erefreseus The Bab deh

That isPail betuten eoi


CEies s it Col be>lime
-Gosotne Dsrance

42 ditctieinel Graih
These in o Caul'se There is aesei
sch as bdectionel Gra>h

N
Subject Date

- Consler Jhe fallowhn? Gralht

feineseLbs
GrPh.

To bhe in cast (weialu)al The


Kin
Laßee his is a gcheal GraPh

Abstract Mumbers sanl by


susiney Abstract Aanaoets
2 is kes hen 3
Ip bhe fren GraPh relreseses a derk,
Subject Date

to braee alle 2b
3 fchets
12Rackets
2

"3" 3 less Than sine'2"


A so,3is in Cost T han 2

isth

dstinabn
Sottte

Soulee se to istinekien_lode
Bive

C-e-d
-e
No.
Subject Date

Question: Can we fiud The Hak Nubmber o


fths from ohe Mode to anethr ?
kloak Lon The Anstwexr

Quesion : whe is te deren bEweeh


Path C1) and Path 6)?
Siae Path
JuisaEng the Feach

i Usire
Mo thah cae

wheh athe fath is ehtiahel


source and oistinaticn Noles cme Also
Aent iohl
L Souce and distinatiah ale we
Leel to l L shortese Pcth
Betweeh Then
sh¡riest
eth
yheteis on Sihay Gralh Alyerithms
N
Subject Date

Connectd, disconnestelGrafhs
Uhiresial,wnwedael
Conneckel GraPh

Tyreis a lath GeaPh There isMo


Prem Fach
Wodeo Ahathey
Conhechel

Unditeckel GraPh
pwhy
Subject No
Date

PirectelJaen?1
Laif the Grah is_cirestel

Wek!
Conhectcl
Strongey,
Connectcd

The /s
js et feast Path Arom
oheole
isat ahotherNoles
Beachable in The Grah
Ayam ather
oes in

So, The Graih AboVe is


Direste, Strangey conne Cheel
Crath

Direste s Weaklp conhe'te


Subject Date

basy onsists at
Two sets
liyes
Questioh'. whut s the rlatian betwcen
Jo ih The Answer bask to
discrete Math
Subject
Algerithms (lb) ilad
sfecial Gralhs:

1- Complte Graph.
2-Cyle GraPb..
3. wheel Grafh.
4. Bifrite Grafh.

* Hew To ct Celeulat the Mahbey olEdqes i

helitected

whete khe clegiree is the uaber


o Edtes Conectel wih adode

wheres he Jumber af
Edyes sum(Jegrees)

loEeach elye connect Jueole


No
Subject Date

&&hamPle Veriiytmbat
Cohhectrol
wibh

-3+2+2+ 2}1 l

ote Ta Te Grafh amber (2) we to alle.l


an Elge beteen "3" londi2"
Z Sowe can Aotice Tup Euery Fime
Ese h Tee BraPi
The 2
Date
Subrect

in
ih.deg1)-1
Oleeleli):2
Sum lelez)= Suminj S4mou)
(n-1
5
sun lo)2+1lo

SabmCleg. 5+5-lo

Sum Caut -ohy?

in [Link] ohe
Suhject Date

-sfecial GraPh
A1 Comlete Grelhs

anles

Lacantleke hew?

-degree
Canilete
Subicct Dat

Lconlele

ae
No.
Subject Datc

f Eyes SunCdey) hn-1)


2 2

Nale is Thee SaaeASole eithout


uiShg Uisitirg a Mle Mone Ty Thah ohce

C2

Cyla Gatb

Cy
bcyck Grah
les
4
Subject Date No

we Can atice lke Pallowin


ZTae dedree in The ceycky cyce Gralh is.
lwayse =2

a rofesalQuestin Could be as Polowin

a setiad Gruth
Give s Yules sleeiln Te anbey of edgs
de yreeec
Subject No.
Date

3wheel GyaPh:
o Te wheel Graihis_a cycly GraPh buk

wheel Grh is dehekel ay W


Lo whee is h is the Mumbeno

ht1

Za Rec The deinitah Sajd


Taek The wheel Gkefh
in he ori insHehe
Th Junber o ele

shoulelat echange

NO T E BO
Subject Date

amls
Wn
Rheel Grafhla

excel the cent ale

Mamber Jumbe 2
-Bh) th th-2h
2

Wumber

Center
Subject N
Date

2xh

Doesot hasle eihe el Betweeh


Them edseot
fath

Vn

in Tae Buth sets

afles

setwecn ' i d ?
yes Ae ro Set 2
Subject Date No

The Gralh is Biactite Grelb is Calojhy


sysiem

systen is Taeo Colors Bel Blue Thut bail be Usel

Zbdo cdors worss as lhe bolloing


SholdSat hale

stact Arom celoingy a ole with red

wta it wita olifaeret coldo


Subject Date No.

if Tere a Twe Aliacentedes Have


The same colon Then The eralh is ot
Bifarte ohe

Thas hve Te same colorin The same Sef

BIue

e)
Subiect
Date

bot Bifal'hje
"2'' a"y'' ne
ad adjacent Weles
Celar

Comlele Blarite Gralh.

2comflee

is o a el between any
Tlo aJes in The Sane Set
AD
There Hust bean
betweeh a
anl anole Eram ^S42
2
*oftes
2
Grafh
4
bhsi2e Sels
conlek
kn,m
UNotes Having Graph Locomflte
Date Subject
No.
Subicct Date

Cohsider a Gralh Have The felouina lo Sels

4
2
bcomllete
BiPar GraPh
6
Leach ode
in"nConbecte

$ilte

ssumldgre) (4*h)+&*)

2
= 24 12
Subject Date No.

Tterval Graph
Lswe Cn Say Fet th itarve Gra
is a Grah ahere eech ole Refrschis
Tay ,Neles Refresehk The itefse intersestiah,
Betwen Two ihkcrveks

AEkam Ple sulPase That yeu hale Te followjng


frocesses, anl These s frocesses showdl
pbe sehtd schelule oh Tze
ceU,Giviny That Zech Groaess kae
a Stant ahd cae Tibse oh Tee cp

ol Tze acesses Could be eXcWbesl

roceses (o), l2.).4.),lz,)


Cls4)C6a)
Subject Date No.

lets Refresex Cecch frosess as a ole


6

continle our Elamlle het is Te Min Magbp


olesolceslcfu)pled
To Run These rossese
Subject Date No

Lbe inte Cseched iocases.

Hew To use celoriny s3Stem to Solue Tae froblen?


osarting Crom usina) obe color
bil i lossble fo_celar Al Nales
-belse
Lo Ale Anothan coler,cn so bh.

Min umber af resorce[ 4

of caloling ae Nedes Is The


Ain umber of CpUs s wikbe
StilThe Seme?
lock afor lke Answer
Subject Date No

Grapb IraPlementalson

OAdjacehcy Zis
Th dance arices

0Aacency atrix

Teo Mohes Are


Adjacent chl caluimns
Thete is an elge Beteen
Subject Date No.

*How Tie adisancy Maerx aoorks?

Laip there s an cle between Tuo ales


we Put in the intescctlop betwcen (ls)in Tae
ah clye kekwecn jad

that there is

6)
Subjsct Dat: No

4 | 5
1

2
4

4
0
1

Haw Meny 1's in Th rolw 2"


3
Hue Man 1' in he celaimh"2"2

we Et Can
yoleched Aacency Mati
Vndirecte Gralh Thut
No.
Subject Date

frofose! ueifion Gouwld [Link] you a Aljcency


Manix op some Grfhahe you have to Druw
The Grath rom he Matriy ahal APly Some

Gralh Alyor;thms Such as shorhes fathSete

A AnswersJefenley sn The Graph

dnditeo Undirected Srom The t AjeseheAeltix?

(Hate, th Sqm e
ge Thee is "1" beween "12'an Alsa thete
betweeh "2,4"

- The GraPh is inest iA

N O TE B
Subject Date No

taw s Show sil the Gralh is weiyheel

Losfecil Cesc
ieAL 1'% in he Gre?h
That 1's 'are oeighe
were weigy Hoy to
dallerehtiate i Aram
Uhweiglrel araPh
La By s kiry the user
whoinsertel the
GraPh ih To The ComPuien

Beirese This Gralh by usinay atace


Subject No.
Date

| 2 3

2 2

-ofeitesetinay pireel Gnlh by usiney


Adiacency Matrik

1 2 |3
1

2 1
3

5
No
Subject Date

-orom the lrau Marik ,Hod to know i kh Gralh


is lirected ar Wot

Lo Bycheckibay Al ESyes in The Sr Matrix


ahd il here is ohe elye whene
Cisisi) Theh The Gralh is
Directed
L Ilseis uha:rectel ralh

SVote in yal ile Thare is Wo P l Bidirestiohedl


Gralh ohez
Jamher of 1% in
AlLelyes
in The Gralh

ee column = in leree

Adjacencf List:
T Beireçehtin De GraPh by usiny elit,
with size caual te the Uunber alosss
And Ench ade hus is on List consiskes
Subject No
Date

uhweigh
tcle Uhelinectel GraPh

11211 The Same ates

Mattix Coulel
be AfPlicel
on The Adiaceheq

How to hnow
weisatel hlectl GraPb
Node Directed is weigutel

Nut
Date No.
Subject

Ihcilance atrices.

Lo2D Array, whele Tk Wumber of awes =kumbel


of Aadeycnd umbee af colunhs =Amber

+The incibanee Mate'y Refecens Th Wosles


in he GraPh

e2

Bouws in

Matrix
Re'resens
The Joes
And ~ench
Bow Beresent
The connetkeel
Eyes with Calumns Reitesents ges
The WerixVn

(4
Subject Date No

*Wete The Jmber af 1: in each Celuma.


is ekacl Two
Ekacilg is
Connect only Two oles

in

oAljaceht Matnx Refmn Flses


Th ingerseatian Between laoHowe
Moes Befrses That there is ah Eebetween hcm
Tredance Katrix Refvesents

Wumb
Lo Befresen's Tke Existence ch Exactly
Tus etes in an Edge
Subject Date No

Nate'
The in oudegree ain Ihe Adjacehcy List
The size ot the Aljacent Lst ol
That ode
An The in-derec in The Adja cehey bist
Codld be Calewlatal bye
L The freauehcy o The Nole in The All
Adcen Lists
Subiect Date No

Grath Tra versel

Dlis Alodes in he Grlh

ot Dullicatal or relad

Dpethirst scach
Breh Eist scarch

ODelrh first Serch (DES)

Aexeheble
Siactiny rom Seleeting astatiny ode ta
Start ralers1 STom jt.
hat
Then we o Rro Ceed ta al other ole
is Seachable Prom The staring Pojn aal i uhUisiel

cthec unvisit edAles ih The Gralh


Bw, basd the Rreu a , if we Start HaNetsire
oele
Lcom the Statint Nose to Any sYta chabl
the
from the Start dle whl ewe reach
shallowesi Uade 'in the Gralhs lfexent
No.
Subject Date

ohey Loke
eachatle ale
Lasoee eelko Als ohe Conditian ko Hale
The sabne sealece foc the same Staltina Nele
The coniticn is APhabeg el crden
LettersA,B,c,D.

sRenchable
8Uhusited
AIPhaeeical oclesed

Word such as CADk


Ly The'c" bcames before

Thacin DES by ains T fallouiny Gralh

K
Subject Datc No

Tracin Pirectieh
Wot an dyc Usiteo!

Ste?1) Stelce)

Stell3)

Stell)

Path 1-2-3-4-5-6
AJote we elee the Ele between "2 ak ""
feethwill be
No.
Date
Subject

oleiP the Uamber a oses that is U'sireol in lk


[ath cqual tto th Waber of oles in The Gyah
Ikeh, Re Galhais Conneckcel

Prom Pathl1) can we kho i Jhere ise a Ph


Betwee " 2"
Alyes
Lo lwhyBecause Th Bralh is Conheched i
Then TheYe Must be a ath bewen

Cah we know the exact Tath betwecn "2"9l'5"?

The Direchions o the Elgs

Qusienif we changel the starhng Pind; Does T


feh chan
Lo e e s

(1 NO T E B O o
stefl2)
Stef)
bheacaable DES
by'oe level Caks Tiaverine Lo
BES): Search( Arst Breadth
No. Date Subject
Subject Date No

-o fath 2-3-45-6

Alwzyseeaual te the Path Rraucad b DS

Toe Grafh ,tlene rhe Bnahis Connesteal

T B
Date No.
Subject

Some Galh Algorthms

) shortes fath Alyorit hms


lhweighteel Gralh

ologcl saltiny
LoDES
khan' Algarithi

niumum Sanir Tre CHST)

Qshortest fath Alzerithms:


Ia l The sherkest Path in a GraPh we hale

LoThen The shertest fth betwceh Soree anl Disina'ah

he Soulee le?
oHa who iden:es Selteiiatto
shot hest ashin Uamlber bet ween T le
(17)
Subject Date No

we haNe e chotces por selectinsy Soukce ole


anl Disrinakion Singe olstinalian
single soAleRAuilksinakion
etsKdi soateai lstinakishis Bouiy
Alyacith wark

The cost in
D

freveosH The Cstar th


Asse is
1 awhy? Thy Cost
is ot knawen e
LsHow To Calutate
The Cost2
LRreuious cost.a1
awe ove
kench Tine ohe
13)
Subject Date No

ol'shattes
Date No.
Subject

what Abaut the Diteced en undire chd Galhse

LHandtes tBoth Direstel on Uhdlte Chel Grafas


bu in Real Lile APlicatio here is o
Aeanina al the ineitecd auPh in Saj
Paint ol Wie Ararm These Algevi thms.
-4

s Thete Any other ath

20
Subject Date No.

kamtle 2

ao,why?

Wote Cinsrtan

Loit wil Mever be adisination ole

21) N OT Bo
M
Thenbekweeh, feth Co[t Les The
silecis Then Grath, The inDole Same LeudineyT
lihhabion. al Souree Joetuxin Leiee) Cost Kin The is
PethAlaritao shorkest Th
eel QalPa. Jirected aor
ah
Algonthon Dijksres
Alyaithm krskals
sfahniny
Iree Minimun
Algyoritbm Dilkshras +
koutlines
Alyorihms Subject: >
P Subject:

Haue Dijksn's Algonthm worss


on. VsitAL Des

Tasert Th eachahle Wole in The Teble

i The Zeatle
en, Do The sane far the other rachabe ales

la Paah Prom oneole to Ahnothen is Pounde


Ap t bas Jes cost Jhan The ohe cxis0ts
Bellaca he ol Path eith in ehe

-ohe eXisits,DPiF

1 T
2

2 4
brAacs co lor For nseleched or proP ode ne eth
Subject
Dirert FAe Pistnce
fran
evje
Far Toaciy Wol

1
3 T
3

if The.
fail isertt
into the
fath
Flse
Lodet Shart with3" (vtfu
1
213 1

etram Mode" we cah go ta lhree ales

0 3-1 Drafiti Alteady sclecte

)3-2 Drofiriwhy?

Beehs
The reu
Ckisiin, th-2)
Seit willbeDlaied sisce
Fere t Shortest
Path untl
Subject Date No.

3
2 3
3 T
2
5 s5
6
Q2-l Drafi. Alrdy seselechel
a23Dral ij Aigher csk is ad

The CoSt Thet

425lis Lets

selectiwhy
Aat selecte

Paz
1
2 1

2
lo 1
4
PDrelel 5 o
Eath

1)
Subyect Date No

O5-3Drol i Because it% Area Dr!

be less

2 3 1
2 1 T

5
The Pne GraPh i

ath

2
Droled Path
Subject Date No.

"Questicn Fron Th Lleniny


Tablk, Can We nghine
a lath frum "1' to "6e 2 3
3

Starthm frem le last 6 T.


5 2
Nase in T Requjnel lath
which is '6"

An the whar is k for the Revieus


3-0:3 (Rrcost- Cost)
it was on

Cast af (5)1
Subject Date No

ininum Sennin BiefAST)


inimum Tk AininmAb Scstto feach a ae ih Th
Gralh

sfaming'; AeachinyAale in ke Grafh

bbat is r|ep

DBoat
The Raat in As is Ahyc ole
in The GrPh
7 occles ia The Tree aheh Convetihg
aeralh into ST lwehale ta elaale
The cydes fvol Tae Grh

Caahscket the Roat

is a bac7
toT Alled
Subject Date No.

Suminary. MST irs cohNerinqy a Gralh into e Biee


whe Al ale are Veachable saist wth
e Minimum cast Afer Ang fath. R
aate AST catks ah Uhiteckl Greth

Jhe ohe with inimjn Cost

bconsider he exr anle Por acin.


Subyec: Date

ExamPle

-Try Al faths that'r


And choe Beachuble Prom 'st.
The
Path Uen eyde
-The Tree wll be

A fE esible aths
in The Ioee
Srel2)
Toes All Phs Bram "5' anl "
The Min Path is (5- 4)

Tn sdeet Ta Kin one

Cyely fach
Cos
Peths cycle selected
or Eher
4
whiach ohe Min The select
54fDeliAlkoly
steatel
seleael DsbDofi
Alealy
selectel Alkea it
Prol 4s
Path cycle iaDrof 4-2
bench brom (ath Al
-Thy
4
No Date Subject
Subject Date

A tat

Anathec oe

The ak anol Jatt eans There ale

iimi's Algorithn = star Aram sale cing


MST Algorthos
krskt tyorim Shart fro selecriy
Edyes

or sefah
Subjcct Date No.

4start;ng Fram Skching a Start le


-schease Tie AinNon chcle , unselechel
Path betWcch All other leths ie

Asas ane as the Prevouis Eanle

CianPle Tacinsy friss on le folouiby! Gralh

A T
in he B T A

Total Cust= 25 2
T

(12
Subject Date No.

lo

-oYareye colas
fer seleetel

-Blackicalap

kluskals Alszrim

selestnay Ehges
Since We

Aseh Acsena Ascening oder CAin tokay


a How kruskal's wetks

in an Ascealisa tler

(13)
Subject Date No.

en, Select the Mnt e in Te Tablk qnd APeLy i


in Te GaPh &and Bcimembe Tat the ESae should at

Ang onecst
atehee kruckals_Alygaithm Gives you e

kcskalkAlsyothn cald huke Hare than

Eramtle: Afily kruskals oh k Lloiy Galh

(14,
Subject Date

False
2
DG 2
CE

H6
GE
BC 4
BF
BH +
BE F
AH
DF
AB X

kraskals Alsarithm AF

5)
Coslses efher Al
has
frerequsit conflis
etiry Sortin
lololoicd Examfles
wh
Asks Some
Comleiaay fciatity
of friefetg isa Thele
orber each on
leenetny katk ofereetians
se Some halie we
Sorti logjal ofa
Sort Bucher Sottiny Tine Linear
Sorr hadik
DFS CutLines
Aotbps Subject
Date
Subject Date

GEx2h banctiath 'faa" Takes lave atamete's "asb"

wheh lhe a" anckian Could be elcuel?

Haw ie FsPelecul sot ot! be Resesehes ?


Cin other licds How we will fefresetes Thet sorse.
Somethindefenles yie) on t Ano ther Tkiny
LoBy uSinay Gralb
Precta Coteced Gralh
oAcuyclic rected Gealh
Acyie GrahThat has a Anu

Aor cyy Bralh anel Alse Hac o cycles


(2
Subjec:

Goltions

At lcast Hhee is ohe

How to show Thet?

freiegsties ot Stainy eine

LThe Artas incielatec lor freCuisites

Nate Mer Than che


it Cald be exisit-Jos eks ith inbeee o
oEk you Can ake the"Piscrete Mathcours
Simuo Sinoulbansly with "t"
Cours
hute is Alast uhe ae with OLt-degree equal

e D cyclies in The Crafh.


Subject Date No,

khans Alah
DES
Lo Araceit by yo sll.
Ps k DFS have The Same fth oerof
the sha's
&kha's Alerirhb slgyorythn2Look for The Answer
L How it works ?

with the ele that we halk Startel with.


why suostaciny ?
oor Exan'le There is e colrse which
HaMe Lo frereeuisHes, one has been
kakeh Theh i wil haue ohe Berequisties

Befea Th fpevious laro Sbes forALLale

in-dejee

(4)
betwecn cydy a Theis al
2
2
2
indegee
1234
21
Die
Subject
Subject Date

2
staYhney Prale"1"

.2 1
Subject
Date

in The rafh toh bow?


LThe aIk-Jegiee for cach
t o z ohe
sowe hae Aore Than Obe Enl we Can
Go Mext to Any one of hem
Then we uill have Mote hah one_ath
RathsO423-E-b7
Subject Date No.

LHelce, Thee is oie Than ohe fath


stert be

laths
4-3-l4-5-b-1
Subjec: Date N

incar Line Sortia Sortihq i

OBucke Sort Then 'Pisicbuian ssct',


cahtingy Sort

Th Cam Papishs betusa,

Thee is an Alaithm Tha's wck in C

BecaueTh Linear Lime gSartiny Work


Ubder-etiie Certain Coholitians
Date io
Subject

How Tk Raeix sort wotk

Lo By comlating item cht by cit , Jar Fae


Aast sihifican 12Z st Least simihcnt
Cit (MsD)

Aast Sinili cat Least sinißin


Cr MSB) Bit CLSB|

Cauld boe inflenetd by stachig lram (Msp)


or SlalEy Brom sD)

SkaCins Sortiey These Manber ham (MSD)

cdit r(MsD)
linit
unbe ohe Thn More
cantisns Thar uuls
in
itt Secaal
lerte eansa the with conare
Lihe AleteThe
Black
424 421
871 871 410
460
209
tto
370
241 370 370 370
204 241
9123
209 294
123 24_
24
11D 312 127
127 921
t23
11U 127
Cormlariny
Eramle.
toAhethey Grauf one Aeem Moves
Date Subject
Subject Date No.

eteeNumbersay beovel fyom_ohe GYoul

A Hence; h each Stel tdTh Wambelr wid

And FeSort Ik umbesbisedo.t

in Virtul etwalss

(2
Subject Date No.

Examfle oh Sp Baiy Sort t

q21 204
127 410
291 110 427
23 q21 26
921 423 241
460 291
370 871
209 123
127 871
110 2o9 291 q_21

conditien Bale sotti


Aunber llgis

we iteyate on numbers
tachum ber TLye
ekgities which is
Lonstient
Subject Date No.
S

BucketSort :
idcaafTk Hash Table
bench Buchet Kelresehhs an Ctoeory a

oCohitish for The Buckef Sort:


All ambctes shoull be between Ocoal O. qq
uhicla is Co

Buckzt sork; How it worksi

bu sine Bucket Sart T Sollauija saalel be doje

Aulily AU Nambcrs by lo

fut Th argiha aes baseeloh The

Lkate igial Values The walies

(1) TE
Subject Date

Examfe surt Th Solowig umbers by usina Bucher sor't

o.42,o31,0.2,6.q1,

Aditly by la
Bucket umber

T33031
J 4 ] 2 , t o42, O.44

91o1,O 92
ake Dekermininay wheAinbes Ar the umbers
belatg ha which Bucset eeiay oh The
BJT, DeVasles a ik in Eeach buche
is Tae vales Baferuellyirs by' lo
Date N
Subject

’ APrlicatioh oU Bucbe sort:


wieless Camiihicatiak, wele Lach Buchet ja
recivel, Anel The kciver Beasscnbi Te Bucke

ete The Valucs in kach Single Bucket is lol


Discusse Beßare

%Couhtiny Sort

itcms cand Deleheking oh Te Prequehcies


Th itcms SOrtel

The Range is
The Mak Valde

The Junbers j s
(1)
Subject Date

Couhtigy SarEs Hew i wak

Ta StalE Sortsa by usingy Cauhting Sork he Aroyes


Neclcl

Aequchcies bay Eeach ioha


The iroler indeyirs
wil be caleuoted by

Betse A aes"
-Tk size l'c' is = s

(T)
Subject Date No.

ExamPlee 12
A 3 4 3 s

2 3 4

12 5
B

Ccssbe An Tiacigi

1 2 The frequenct
for Each Eemets

leineat in The Array "A


Subjec: Dat

Iracing Th Loof:.

CL3] : CIs7 +1

:1

cCa) C[ac] +1
CI5]CIsJ +1
CLs] = O+1

e
C[ab]zcIas]+1 1 2

2
-C[3ec[3]+1
0112 o| 1
-2
Subject Date No.

2
c[il= CI1T+1
1 2
-1

C[4l:CH41 2

=1

12 4
C[3]C[3J+1
-2+1 1123I17

C6l- CrE] +1 2 -3
5
1 32

(20
Date
Subject

CLil: Ci]tCZi-1

Countinsy Sort sotinVanbe's


We Said at h
emeht
Based oh The Siz uehcyaf Feach
Haw?

Aseag A js The ak Eleneuy ia A"


Then where Tae Max Elemeu shoud be
in The Array "B
L AAec A The Eemens.
Lasos in Jaelex =5?

Coul be eleeteal
Hencejwe have T alcuate

Arequencies

(D
Subject Date No.

[Link]-1] 2 3
CrA21C[2l+CL2
|1/22/312
2

CB)B]+C[2] 1 2 4

5
2(s5|12

1 2 4 5
CrleCr]+C3

C[s]= C[s1+CL41 12 4 5

Value

(22
Subject Date

ake The Arnay "c aw Cohtaihs The st

afia Remeaber That Aray 'c


af the Arrayy A" ahl'B'

Value -L

BoBut Hal) ko kheus Ha) Mach


"E' Acneht in The Arra "B'
o be ?
L,Basel on The feiests

kEleneh's Walue in Array


Mc'iwhich is

be stotd in TheAray B"

3
Subject Date

D for jen To 1 totave to. lhe hekt


BEAci =A
Elene
C[ACIlcACI]4
By usin he Values inc';as were icuseil

B[CCAA]AC
B[cIAi AC3
12
|125 6
CtALT0-C[ACIj-1
CIE] G[57 -

BIS] $3 12 s4|/7c
5 -1
(24
NG.
Date
Subject

B[CCO7:A T61,
CEAL17: c[ACAI
5 678
C[4T CI4I-1
=6-1 B
1 2

BICA-A[S1
BI11
C[ATsJ -CCAEI -1

BCI] AT4 B
2
cCAT4fC[A[]]-1 642

(25
Subjec: Date

BIc[21]- AC1
BC27 =2

B A5 2

=Cs] 1
7-1

B[Ca]-AT1l
123

(26)

You might also like