0% found this document useful (0 votes)
25 views12 pages

Data Structure (Section - C)

The document discusses various sorting algorithms, including selection sort, bubble sort, and quick sort, detailing their advantages and disadvantages. It provides step-by-step instructions for implementing each algorithm and highlights their time complexity. Additionally, it compares the efficiency of these sorting methods in handling different data sizes.

Uploaded by

anmol97280
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)
25 views12 pages

Data Structure (Section - C)

The document discusses various sorting algorithms, including selection sort, bubble sort, and quick sort, detailing their advantages and disadvantages. It provides step-by-step instructions for implementing each algorithm and highlights their time complexity. Additionally, it compares the efficiency of these sorting methods in handling different data sizes.

Uploaded by

anmol97280
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

Dote

Seciom-C Poge

the aleuoing
Sutehle
taking
(a)sele chem Sat
(6) bubble Sat
inalertion 5ant
Herge Sant
(e) Quick
() Heah s&t

A (d) selection Sort

hi
at a ime and Lomaneg the

Selechem Sant the Pinaa


eeated Selechoa
aleeiie
the a
annanglmaiat a data
Sanh
ohenatinsa enfamsd
he
saence.
lable

Sele ien set Tine


StePl srace
oc=L
MNA T
SteP: set
Average

Step4:
MINACT]THEN Cage
L0c
Set MIN= ACTJ

Se le ien Sart
5te 5 tuit

and slaa (omleaity


Atvantayeg Disadatye
The (endíha i a Li> a iJ i5 euered

Be
Aduantac
it averese the
suld be o Same, seleion Sant is quite simPle
The 3 entta Vaia bles aduaatagcg
(omllicad
Date
Pagy

Aoni th m

fine
sele chen Sart S hauing makeg is SteP I : Refeat SteP and 3
o n ohich N-1
santiy laye
ste : Refeat SteP 3

Ste P 3:

Bubble Sart Ste 4: fait

Bobble Sart is Sim?le ime (omleity


(onlazing ach ain
by
the time we See
To alulae Lomlenity
The list the eneuhon
ontil
ndia teg tue ist Hence time is

Bobble Sat be ame


hag
(ohich nakes
tine come aity Ihe numb)
Qnd

Hez asainthe Rutra SPaee


thtee variableg.
Pac

Date

Table
Disadvatjea.

Ltto n-( 4 i5 the stoweat Sart


n -2 taund in bubhle Sart
1to n-3
3 Sant is or)
seetion Sart.

Jnsexhon Sart
h-1

Bo bb]e Sart oheneit uea Sartd list .

Sart Sim?le Sanh n


olearthm that builde

Adyandays Disadantail muh leae list


monl aduamced

mar n Prachie than


Bobble Sat is simle. to imPlement Maet othes Si mle

Starad lis
Date

Tase

inltudt <io stucaw hz (maige


to 3
3
# delid 1to 4

Int a f]yik tem?te


1to n-l

dndertion Ssrt
(aut "ln sarkd
for CizoiKN it)

Ad votayza isad vamtegte

Advantase
almat Sarkd Iwar stibn
Sart sha ettea)
bette) Renlaratctb
Date

4 is a linlar Sarch
wth
fox Chample

Disad vautage
|4
5l
19
is

hecanas
List List b

be

to Small data lo
data
but

Thenl tuwo mezgl aant


Melge t
ToP - doun

is Hhe lembinaien
too
jto

atu0 meryl two Sarkd

Can be Inta
ToP- doun Battom-u
lentn n
Date

343

to divide the
3273g 3
which
list nto
kcurdlaa
Suh ist
9lo
lo
elament S 213843&A
Herje auh list to Psducl
5ub- list therl
Yemainy Bont is a
the

3 2143 3 (i) ohich tae

glamt
ist dainp nn bg m
3821|433
The ub- ist is size baky
tae list SiZe

3
DisaduantagE
Alsarith lo
lou), =MI) +Ly K Mexse to oth
Ste? l: Set I - Bort

ALJ] Herge rt slare to


Set Ik ]: Stare
set

(e) Quick Sovt

MID
Step 3: Reheat akile I <
set IkI= AlI Quik Sant is antiy technigue banol
fhe Prinotle

A diyide Solveg

Step 4: uit the

lutns mallla
(ombwyoo tau nthe Koluti g
to
Ad vautye lenete

Messe Sont a The RazfeA qik


data item
list n onme
be uao ink ist withaut The nuthod educge
a sreet distaare
taliy slarl.
Page

Qick dant
A&erion. sRars
seh eltRRgat
(as
(oenity
Average
Ste :
while
tok
Ste P Rekeat steh 3 o(n)

Ste 3

6uick SoBt

ste?4

Steps enit

Advaatagz Qisadvanayea
Time slac

Aduantageg o Quick Sant


Her

funhbn quik is called it is

to t
every ti kecui
mlisvau ables.
(P) Heah sort

data
Abinaag heah is a heah
tie
a a binag
uding
Healh be deen
oith too addítiaaal epeaiea

shale Pre<eaty

Heale ont be
Paxte Peenty Ond Min- Heah
So 65 6o
eloanont value
Valu th to
than nade value The
Piepenhy Heah -Maw
Rrelenky
Hea Min Heep Mam-
Sot Heah
Page
Date
Rsorithwm
RMin - Heah figenty
SteP L:
than SeNtL
Value elamLt Ste Pa : while
Ste 3: set PAR =C PTR /RI

SteP 4: -TREE (RAR Ithen


Set Tiee fRTRI-item t Retun

Stel S. Set TREE CPTRI = TRES CP A

SeP 6 bait

You might also like