{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Exercise5 - 并并并-并 并并...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 并并并并-并并 并并并 并并并并并并并并并并并 5.1 并并并并 ① 并并并并并并并并并并并并并并并并并并并 ② 并并并并并并并并并并并并并并并并并并并 并并并并并并并并并 并并并并并并并并A q 并……并A r 并 并并并并并并并并A q 并……并A r 并 Procedure QUICKSORT(A,q,r) Begin If q<r then (1) x=A q (2) s=q (3) for i=q+1 to r do if Ai x then ≦ (i) s=s+1 (ii) swap(A s ,A i ) endif (4)swap(A q ,A s ) (5)QUITCKSORT(A,q,S-1) //并并并并并并并并并并并并并并 As 并并并并并并并并并并并并并并并并并并并并并 (6)QUICKSORT(A,S+1,r) endif end (并)并并并并并并并并并并并 并并并并并 n 并并并并并并并并并并并并并并并并并并并并并并 n-1 并 1并并并并并并3并并 if 并并并并并并 O(n-1)并并并并并并并并并并并并 t(n)=t(n-1)+O(n-1)+t(1) 并并 t(1)=1 并并 t(n)=t(n-1)+O(n) 并并 = + = …- +- =- 1 ) 1 ( ) 2 ( ) 1 ( ) 2 ( ) 1 ( ) 2 ( ) 1 ( t O t t n O n t n t 并并并并并并并并并并1并并并并 ) ( 2 ) 1 ( n 3 2 1 ) ( 2 n O n n n t = + = + … + + + = 并并并并并并并并并并并并并 O(n 2 ) 并并并并并并并并并并并并并并 并 k 并并并并并并并并并并并并 t(n)=c*n+t(k-1)+t(n-k) 并并 c 并并并并 并并并并并并并 n 并并并并并并k 并并并并并并并并并并并并 n 1 并并并并并并并并 并并并并-并并 并并并 并并并并并并并并并并并 ∑ =- +- + = n i k n t k t n n c n t 1 )] ( ) 1 ( [ 1 * ) ( 并并 n k ≤ ≤ 1 并并并 1 1- ≤- ≤ n k 并 1- ≤- ≤ n k n 并 t(k-1)并 t(n-k)并并并并 并并并并并并并 ∑- = + = 1 ) ( 2 * ) (...
View Full Document

{[ snackBarMessage ]}

Page1 / 6

Exercise5 - 并并并-并 并并...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online