Successfully reported this slideshow.

Intersection Study - Algorithm(Sort)

3

Share

Upcoming SlideShare
Unit   7 sorting
Unit 7 sorting
Loading in …3
×
1 of 66
1 of 66

Intersection Study - Algorithm(Sort)

3

Share

Download to read offline

sorting data set, tons of algorithms but this day we studied only two Selection Sort and Quick Sort

sorting data set, tons of algorithms but this day we studied only two Selection Sort and Quick Sort

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

Intersection Study - Algorithm(Sort)

  1. 1. ALGORITHM
  2. 2. ALGORITHM SORT Selection Sort Quick Sort
  3. 3. ALGORITHM SORT INTRO What is Sort?
  4. 4. ALGORITHM SORT INTRO Make data in Sequence 4 3 8 6 7 13 10 14 9 3 4 6 7 8 9 10 13 14
  5. 5. ALGORITHM SORT INTRO Make data in Sequence Key (comparing data) Sort Order (Ascending, Descending) Sort Efficiency (time complexity) Sort Stability (keep sort order)
  6. 6. ALGORITHM SORT Selection Sort Selection Sort
  7. 7. ALGORITHM SORT Selection Sort select best-fit-data every time s s d d .. d d d d sorted unsorted select data fits this position
  8. 8. ALGORITHM SORT Selection Sort 4 3 8 6 7 13 10 14 9 Selection Sort in Ascend order Min Data unsorted
  9. 9. ALGORITHM SORT Selection Sort 3 4 8 6 7 13 10 14 9 Selection Sort in Ascend order unsorted swap sorted
  10. 10. ALGORITHM SORT Selection Sort 3 4 8 6 7 13 10 14 9 Selection Sort in Ascend order unsortedsorted Min Data
  11. 11. ALGORITHM SORT Selection Sort 3 4 8 6 7 13 10 14 9 Selection Sort in Ascend order unsortedsorted
  12. 12. ALGORITHM SORT Selection Sort 3 4 8 6 7 13 10 14 9 Selection Sort in Ascend order unsortedsorted Min Data
  13. 13. ALGORITHM SORT Selection Sort 3 4 6 8 7 13 10 14 9 Selection Sort in Ascend order unsortedsorted swap
  14. 14. ALGORITHM SORT Selection Sort 3 4 6 8 7 13 10 14 9 Selection Sort in Ascend order unsortedsorted Min Data
  15. 15. ALGORITHM SORT Selection Sort 3 4 6 7 8 13 10 14 9 Selection Sort in Ascend order unsortedsorted swap
  16. 16. ALGORITHM SORT Selection Sort 3 4 6 7 8 13 10 14 9 Selection Sort in Ascend order unsortedsorted Min Data
  17. 17. ALGORITHM SORT Selection Sort 3 4 6 7 8 13 10 14 9 Selection Sort in Ascend order unsortedsorted
  18. 18. ALGORITHM SORT Selection Sort 3 4 6 7 8 13 10 14 9 Selection Sort in Ascend order unsortedsorted Min Data
  19. 19. ALGORITHM SORT Selection Sort 3 4 6 7 8 9 10 14 13 Selection Sort in Ascend order unsortedsorted swap
  20. 20. ALGORITHM SORT Selection Sort 3 4 6 7 8 9 10 14 13 Selection Sort in Ascend order unsortedsorted Min Data
  21. 21. ALGORITHM SORT Selection Sort 3 4 6 7 8 9 10 14 13 Selection Sort in Ascend order unsortedsorted
  22. 22. ALGORITHM SORT Selection Sort 3 4 6 7 8 9 10 14 13 Selection Sort in Ascend order unsortedsorted Min Data
  23. 23. ALGORITHM SORT Selection Sort 3 4 6 7 8 9 10 13 14 Selection Sort in Ascend order unsortedsorted swap
  24. 24. ALGORITHM SORT Selection Sort 3 4 6 7 8 9 10 13 14 Selection Sort in Ascend order sorted
  25. 25. ALGORITHM SORT Quick Sort Quick Sort
  26. 26. divide dataset with pivot s … p ... d d d d d less than p bigger than p pivot ALGORITHM SORT Quick Sort
  27. 27. select pivot ALGORITHM SORT Quick Sort 4 3 8 6 7 13 2 14 9 pivot left right
  28. 28. Move left to first data bigger than pivot ALGORITHM SORT Quick Sort 4 3 8 6 7 13 2 14 9 pivot left right
  29. 29. Move right to first data less than pivot ALGORITHM SORT Quick Sort 4 3 8 6 7 13 2 14 9 pivot left right
  30. 30. swap left and right ALGORITHM SORT Quick Sort 4 3 2 6 7 13 8 14 9 pivot left right
  31. 31. Move left to first data bigger than pivot ALGORITHM SORT Quick Sort 4 3 2 6 7 13 8 14 9 pivot left right
  32. 32. Move right to first data less than pivot ALGORITHM SORT Quick Sort 4 3 2 6 7 13 8 14 9 pivot left right
  33. 33. swap right with pivot ALGORITHM SORT Quick Sort 2 3 4 6 7 13 8 14 9 pivot
  34. 34. swap right with pivot ALGORITHM SORT Quick Sort 2 3 4 6 7 13 8 14 9 pivot less than 4 bigger than 4
  35. 35. sorting problem divided into two problems ALGORITHM SORT Quick Sort 2 3 4 6 7 13 8 14 9 less than 4 bigger than 4
  36. 36. sort left partition ALGORITHM SORT Quick Sort 2 3 pivot left right
  37. 37. Move left to first data bigger than pivot ALGORITHM SORT Quick Sort 2 3 pivot left right
  38. 38. Move right to first data less than pivot ALGORITHM SORT Quick Sort 2 3 pivot left right
  39. 39. sorted ALGORITHM SORT Quick Sort 2 3
  40. 40. try right part ALGORITHM SORT Quick Sort 2 3 4 6 7 13 8 14 9 sorted bigger than 4
  41. 41. sort right partition ALGORITHM SORT Quick Sort 6 7 13 8 14 9 pivot left right
  42. 42. ALGORITHM SORT Quick Sort 6 7 13 8 14 9 pivot left right Move left to first data bigger than pivot
  43. 43. ALGORITHM SORT Quick Sort 6 7 13 8 14 9 pivot left right Move right to first data less than pivot
  44. 44. ALGORITHM SORT Quick Sort sorting problem divided into two problems but left is none 6 7 13 8 14 9… bigger than 6
  45. 45. ALGORITHM SORT Quick Sort sort right partition 7 13 8 14 9 pivot left right
  46. 46. ALGORITHM SORT Quick Sort 7 13 8 14 9 pivot left right Move left to first data bigger than pivot
  47. 47. ALGORITHM SORT Quick Sort 7 13 8 14 9 pivot left right Move right to first data less than pivot
  48. 48. ALGORITHM SORT Quick Sort 7 13 8 14 9… bigger than 7 sorting problem divided into two problems but left is none
  49. 49. ALGORITHM SORT Quick Sort 13 8 14 9 sort right partition pivot left right
  50. 50. ALGORITHM SORT Quick Sort 13 8 14 9 pivot left right Move left to first data bigger than pivot
  51. 51. ALGORITHM SORT Quick Sort 13 8 14 9 pivot left Move right to first data less than pivot right
  52. 52. ALGORITHM SORT Quick Sort 13 8 9 14 pivot left right swap left and right
  53. 53. ALGORITHM SORT Quick Sort 9 8 13 14 pivot swap pivot and right right
  54. 54. ALGORITHM SORT Quick Sort 9 8 13 14 less than 13 bigger than 13 sorting problem divided into two problems
  55. 55. ALGORITHM SORT Quick Sort 9 8 13 14 less than 13 sorted no need to sort one element
  56. 56. ALGORITHM SORT Quick Sort 9 8 sort left partition pivot left right
  57. 57. ALGORITHM SORT Quick Sort 9 8 pivot left right Move left to first data bigger than pivot
  58. 58. ALGORITHM SORT Quick Sort 9 8 pivot left right Move right to first data less than pivot
  59. 59. ALGORITHM SORT Quick Sort 8 Swap left and right 9 pivot
  60. 60. ALGORITHM SORT Quick Sort 8 sorted 9
  61. 61. ALGORITHM SORT Quick Sort 8 sorted 9
  62. 62. ALGORITHM SORT Quick Sort 8 9 13 14 less than 13 sorted sorted
  63. 63. ALGORITHM SORT Quick Sort sorted 7 8 9 13 14 bigger than 7
  64. 64. ALGORITHM SORT Quick Sort sorted 6 7 8 9 13 14 bigger than 6
  65. 65. sorted ALGORITHM SORT Quick Sort 2 3 4 6 7 8 9 13 14 sorted bigger than 4
  66. 66. sort complete ALGORITHM SORT Quick Sort 2 3 4 6 7 8 9 13 14 sorted

×