0% found this document useful (0 votes)
22 views3 pages

Divide

The document discusses the quicksort algorithm for sorting data. It analyzes the runtime of quicksort, showing that it has an average-case performance of O(n log n).

Uploaded by

Arjun kumar
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)
22 views3 pages

Divide

The document discusses the quicksort algorithm for sorting data. It analyzes the runtime of quicksort, showing that it has an average-case performance of O(n log n).

Uploaded by

Arjun kumar
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/ 3

D e i n e diuide nd danguY mtkod tulak

o plexi qwitk Sost Using ubs Htu tion


method

We hqve to n destand in thes gin s H

Oivide Brk-
Th skp invoke) the breeming
th proble m iyb smedey ub-röble»m3ub
Imublem shoudd ie be*nt a por g orlsinal
problem his slepP 9neglA a a irte5sv
hreohto devide the oblemuntil no Sub
blm i thtv divsibla tt this s shm
Sub problems betome atomiin neture but
Sti ye exNb_Some bort dgchvaoblem

onays solU=
This ste smalleY
decirveU det
Sub- robems to b solvtd.CtntTally_2 t thi
qe(onside red solvu on hei
leve ha Iroll m
Oina SubiUion method
ing w (an show the
Tni ima o apiksort is olnz et T(n)
0UILkSoRTOnqn inpot size n we
hovet h e he((uítnr

Tn)nat (T() + T(n-v) t_o (n)


£ V n-1

here he
he_iname kY q Janagrom 1 bn1
bta the proredure PAATITION produce k o
NPaions eath havins zotleat 1 we auesy Tln)_
th r Some Conskunt ( Subtik ting this gurss
W obain

T n )mer Lta2 tcn-) 0(n)


i Vn-1

CmeaXX_( + ( n - 4 ) + o(n)
i y sn-1

e ebhe>>iM t n - heveve) a marimun


UY 1 n-1 t o n t h a ed points.
ot (an In n the second dexiveEH« t
t hr
e
ege>im with 1espect to y is_positive_Thi>
ve U the bound may 4n-1 4+(n-)2)
12 +(n-)2 n2-2 (n-12
(on tinujng wth6us hounding oT(n)y
we obtin
T - 2 e (n-1)n 2
n
Sinc we (an brkthe (entgn t_ arge enosh
So that 2n-1 timd ominuky the n) tim
Ten h (orsB 103t) nnin ime
is n 2.
uick sor

You might also like