Vїяġїи Ĝϋί£Ð
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
บ้านLatest imagesสมัครสมาชิก(Register)เข้าสู่ระบบ(Log in)

 

 Selection sort

Go down 
ผู้ตั้งข้อความ
Angel-beats
ﻬ௫ﻬAdminﻬ௫ﻬ
ﻬ௫ﻬAdminﻬ௫ﻬ
Angel-beats


ชื่อในเกม : Novas
ค่าขยัน : 35
ค่าขนม : -4522
คะแนน : 0

Selection sort  Empty
ตั้งหัวข้อเรื่อง: Selection sort    Selection sort  Icon_minitime25/7/2012, 19:21

Selection sort
Selection sort เป็นวิธีการจัดเรียงข้อมูลที่ใช้วิธีเลือกข้อมูลที่เล็กที่สุดมาเรียงไว้ตามลำดับ ขั้นตอนวิธีดังนี้ SELECTION-SORT(A) เมื่อ A เป็น array
ข้อมูลเข้า A[1..n]
ข้อมูลออก การจัดเรียงของข้อมูลจำนวน n ตัวใน A โดยที่ A[1] A[2] A[3] . . . A[n] (sorted in place)
SELECTION-SORT(A)
1. for j = 1 to n-1
2. (min, minj) = (A[j], j)
3. for i = j+1 to n
4. if min > A[i]
5. (min, minj) = (A[i], i)
6. endif
7. endfor
8. (A[j], A[minj]) = (A[minj], A[j])
9. endfor



*เครดิต [Only admins are allowed to see this link]
ขึ้นไปข้างบน Go down
http://virgin.wow3.info
 
Selection sort
ขึ้นไปข้างบน 
หน้า 1 จาก 1
 Similar topics
-
» BUBBLE SORT
» INSERTION SORT
» SHELL SORT
» RADIX SORT
» MERGE SORT

Permissions in this forum:คุณไม่สามารถพิมพ์ตอบ
Vїяġїи Ĝϋί£Ð :: General Zone :: Dev C++-
ไปที่: