JAVA ????????? - PowerPoint PPT Presentation

About This Presentation
Title:

JAVA ?????????

Description:

JAVA Sorting – PowerPoint PPT presentation

Number of Views:10
Avg rating:3.0/5.0
Slides: 9
Provided by: Shaw127
Category:
Tags: java | bubble | sorting

less

Transcript and Presenter's Notes

Title: JAVA ?????????


1
JAVA ?????????
  • ???? Sorting

2
Selection Sort
  • Selection Sort????????????(unsorted)???,??????(???
    ),??????,????sorted?????,??unsorted????????(???)??
    ?sorted?,??????sorting?

3
Insertion Sort
  • Insertion Sort?Insertion Sort??????Array????(compa
    rable)??sorted?unsorted????????unsorted?????????so
    rted???,??sorted????????????,????????,???????????,
    ???????unsorted?????????sorted???,????sorting?

4
Shell Sort
  • Shell Sort?????Insertion Sort
  • ???????????,???Increment,???????????Increment
    5,???????5???,5??????subfiles,????Insertion
    Sort???
  • subfile1 ? (x0,x5,x10,..)
  • subfile2 ? (x1,x6,x11,..)
  • subfile3 ? (x2,x7,x12,..)
  • subfile4 ? (x3,x8,x13,..)
  • subfile5 ? (x4,x9,x14,..)
  • ??Increment??3
  • subfile1 ? (x0,x3,x6,..)
  • subfile2 ? (x1,x4,x7,..)
  • subfile3 ? (x2,x5,x8,..)
  • ??Increment??1
  • (x0,x1,x2,x3,x4,x5..)

5
Bubble Sort
  • x 3,6,2,8,1
  • x 3,2,6,8,1
  • x 3,2,6,1,8
  • x 3,2,6,1,8
  • x 2,3,6,1,8
  • x 2,3,1,6,8
  • x 2,3,1,6,8
  • x 2,1,3,6,8
  • x 2,1,3,6,8
  • x 1,2,3,6,8
  • ????????????index 0?????????????,???????????,???
    (Swap),????????????????,?????????

6
Merge Sort
  • Merge Sort??????divide-and-conquer??????sorting?Di
    vide-and conquer???????????????????????,??????????
    ???,????????,??????????????,??????????????????????
    ?

7
Quick sort
  • ????S???????(???????????????????),?????????x,???pi
    vot???pivot??,???S?????????????
  • i. L,S???pivot???
  • ii.E,S???pivot???
  • iii.G,S???pivot???
  • ??S?????????,??E??????????,???pivot?
  • ????????(recursively)???L?G?
  • ???L,E?G??S,??S?????(Sorted)??

8
Quick sort
Write a Comment
User Comments (0)
About PowerShow.com