????????????????(heapsort.pdf??)????????????????????????.?????????????????????? - PowerPoint PPT Presentation

About This Presentation
Title:

????????????????(heapsort.pdf??)????????????????????????.??????????????????????

Description:

13 (heap sort)(p.94) O (n log n ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 12
Provided by: acjp
Category:
Tags: heap | heapsort | pdf | sort

less

Transcript and Presenter's Notes

Title: ????????????????(heapsort.pdf??)????????????????????????.??????????????????????


1
?????????
  • ?13?

2
??1
????????????????(heapsort.pdf??)??????????????????
??????.??????????????????????
??????????????????4.7(p.95)???????????????????????
????????????
3
??1???
15???? 29, 5, 4, 23, 6, 63, 12, 2, 53, 12, 33,
34, 14, 23, 37 ?????????? ????????????????????
?????? ?????????????????????????????
swap()??????????? deletemax()??????????
????? ??????????t0629xx_hs.c ???? (t0629xx???????
?)
4
??2
??1???????????,??????rand()??????
?????64000????????????,????????? ???????????.
(??I ??3????clock??????????.) ?????????????. ???
??????,t0629xx_hs2.c???. ????n???????????,???n???
???????? ?????O(n2),O(nlogn),O(n)?????????????
5
????????????
??????t0629xx.doc?????????????? ??1??????? ??1?
?? ??2??????? ??2??? ??2??? ???????????????????
?????????????????????????????????
??????????????????????????(7/23)??????????(??????)
???
?? 2008/8/6(?) 18?
6
??????(heap sort)(p.94)
  • ??????????????????????
  • ??? O (n log n)
  • ??? ????????????????

??????? ??????
??????? ??????
10
3
5
9
8
9
6
8
9
10
6
3
7
6
9
10
18
2
4
1
7
?????????
  • 1.???(????)???(?????????????)
  • 2.????????????????
  • ??????????????????
  • ????-1?????????????

????? ????
???L 2,9,5,6,
9
2
5
6
8
1.??????
  • ?????????????????????????????,????????????????

10
? a0
??? n 15
6
9
5
15
15
12
? an/2-1 (a6)
3
18
9
8
11
10
9
20
? an-1 (a14)
9
2.????
  • 2-1 ??????????????

0
n-1
a
12 5 9 6 8 9 10 10 18 9 15 11 15 20 3
10
2.????(???)
????? ???? ?????
  • 2-1 ????????????

?????????, 2?????? ?????? ?????????
????????????
0
1
2
3
4
7
8
n-1
n-2
12 5 9 6 8 9 10 10 18 9 15 11 15 20
3
a
5
6
10
12
???????????2i1???????????????
11
????????
begin
  • 1.???(????)???
  • ?????????2/n - 1 0????????????????????
  • 2.??????????
  • ??????????????????
  • ???????????-1?????????????

heapsort
heapify
downMin
deleteMin
downMin
end
Write a Comment
User Comments (0)
About PowerShow.com