TÌM HIỂU VỀ MỘT SỐ THUẬT TOÁN SẮP XẾP ĐƠN GIẢN

  • Published on
    29-Jun-2015

  • View
    3.860

  • Download
    0

Embed Size (px)

Transcript

<ul><li> 1. BO CO THC TP C S TI: TM HIU MT S THUT TON SP XP Sinh vin thc hin: Trn nh Nguyn Gio vin hng dn: V Th Thy Tho</li></ul> <p> 2. 1.Ni dung chnh Mt s kin thc c bn. Mt s thut ton sp xp.Tm hiu ngn ng Java. Demo chng trnh. 3. 2.Mt s kin thc c bn Thut ton: Khi nim thut ton sp xp: Thut ton l mt tp hu hn cc ch th hay phng cch c nh ngha r rng cho vichon tt mt s vic t mt trng thi ban u cho trc; khi cc ch th ny c p dng trit th s dn n kt qu sau cng nh don. 4. Khi nim thut ton sp xp. Sp xp (sort) l mt qu trnh bin imt danh sch cc i tng thnh mt danh sch tha mn mt th t xc nh no . 5. 3.Mt s thut ton sp xp 3.1. Sp xp chn(Selection Sort) 3.1.1. T tng u tin chn phn t c kha nh nht trong n phn t a[1] n a[n] v hon v vi phn t a[1]. Chn phn t c kha nh nht trong n-1 phn t t a[2] n a[n] v hon v n vi a[2] bc i, chn phn t c kha nh nht trong n-i+1 phn t t a[i] n a[n] v hon v n vi a[i]. Sau n-1 bc th ta thu c mng c sp xp. 6. 3.1.2. Thut ton Procedure SelectionSort; Var I,j,k: integer; min: Real; Begin for i:=1 to n-1 do Begin k:=1; min:= a[i]; for j:=i+1 to n do If a[j]1) anh (a[j]</p>

Recommended

View more >