Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

of

ΠΛΗ30 ΚΑΡΤΑ ΜΑΘΗΜΑΤΟΣ 2.1 (ΕΚΤΥΠΩΣΗ) Slide 1
Upcoming SlideShare
ΠΛΗ30 ΜΑΘΗΜΑ 2.1
Next
Download to read offline and view in fullscreen.

0 Likes

Share

Download to read offline

ΠΛΗ30 ΚΑΡΤΑ ΜΑΘΗΜΑΤΟΣ 2.1 (ΕΚΤΥΠΩΣΗ)

Download to read offline

Διαίρει και Βασίλευε
Ο αλγόριθμος QuickSort
Ο αλγόριθμος QuickSelect

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

ΠΛΗ30 ΚΑΡΤΑ ΜΑΘΗΜΑΤΟΣ 2.1 (ΕΚΤΥΠΩΣΗ)

  1. 1. ! " " # $ % " % & ' ( ! ! " ) ! % " % # !" #$ % &# #'$ %(% )*+,*-.+/) " * % ) + ,&*'-.,&*/.'0*# 1 2&*345*' 01234-.+/ " * % # + 6&*'-,&7'0,&*87'0*) 2&*.' % # 5267+8-*7+39) " 9 * % ) + ,&*'-,&*/.'0*# 1 2&345*' : 01234-*;*3/ 7 # + ,&*'-,&:*/;<'0*# 1 2&*'# < -/+7==*6) ! *=* % # + ,&*'-:,&*/.'0>&*.'# 1 >&*.#?;' : ( : : 0>?@A-BCD E F G procedure QuickSort(A,start,finish) if start<finish then pos=Partition(A,start,finish) QuickSort(A,start,pos-1) QuickSort(A,pos+1,finish) end if end procedure : ! " : # ( $ ) : : • % & " • % • $ . procedure Partition(A,start,finish) odigo=A[start] i=start; j=finish for (k=start+1 to finish) if (A[k]>odigo) B[j]=A[k]; j=j-1 else B[i]=A[k]; i=i+1 end for B[i]=odigo; = return pos; end procedure ( 12 ) : ' 5- : ( …) 0>?@A-HIH@D E G procedure QuickSelect(A,start,finish,k) if start>finish then return 0 else m 5- . swap(A[m],A[start]) pos=Partition(A,start,finish) if k=pos then return A[pos] else if k<pos then return QuickSelect(A,start,pos-1,k) else if k>pos then return QuickSelect(A,pos+1,finish,k-pos) end if end if end procedure : ' n . ( k- : ) k- : : • % & " • % • . procedure Partition(A,start,finish) … QuickSort … end procedure : T(n)=O(n)

Διαίρει και Βασίλευε Ο αλγόριθμος QuickSort Ο αλγόριθμος QuickSelect

Views

Total views

5,391

On Slideshare

0

From embeds

0

Number of embeds

4,669

Actions

Downloads

103

Shares

0

Comments

0

Likes

0

×