Bubble Sort

  • Published on
    20-Nov-2014

  • View
    1.046

  • Download
    1

Embed Size (px)

DESCRIPTION

A powerpoint we had to

Transcript

<ul><li> 1. Bubble SortBy: Yoo Lee &amp; Gabrielle Ortiz Block 2A</li></ul> <p> 2. Basic Introduction:Bubble Sort is a simple yet effective sorting algorithm.Data is placed adjacent to each other.The sort starts from one end (the beginning), compares2 adjacent data, and swaps them if they are in thewrong order.It moves on down the list and continues doing so.When it reaches the end of the data, it starts over untilall the data is in the right order.*As easy as the Bubble Sort is, it is sometimesineffective if there is a lot of data. 3. When to Use Bubble SortNot much use in the real world, but is a great learning toolbecause its easy to understand and fast to implement.Use when a fast algorithm is needed to sort: 1.) an extremely small set of data (Ex. Trying to get the books on a library shelf back in order.)or 2.) a nearly sorted set of data. (Ex. Trying to decide which laptop to buy, because it is easier to compare pairs of laptops one at a time and decide which you prefer, than to look at them all at once and decide which was best.) 4. When to Not Use Bubble SortWhen dealing with a large set of data.When you are looking for a quick algorithm.Compared to other sorting algorithm, bubble sort isreally slow. 5. EXAMPLELETS MIX IT UP!! 6. EXAMPLE 7. EXAMPLE 8. EXAMPLENow this box will go through the list, swappingnumbers if the one previous is greater than theone after, until the numbers are in order. 9. EXAMPLE 10. EXAMPLEWRONG ORDER!SWITCH! 11. EXAMPLEThats better. 12. EXAMPLEMoving on. 13. EXAMPLEWRONG ORDER!SWITCH! 14. EXAMPLEWRONG ORDER!SWITCH! 15. EXAMPLE 16. EXAMPLEMoving on. 17. EXAMPLE 18. EXAMPLE 19. EXAMPLEWRONG ORDER!SWITCH! 20. EXAMPLEWRONG ORDER!SWITCH! 21. EXAMPLE 22. EXAMPLEMoving on. 23. EXAMPLE 24. EXAMPLEWRONG ORDER!SWITCH! 25. EXAMPLE 26. EXAMPLEMoving on. 27. EXAMPLE 28. EXAMPLEWRONG ORDER!SWITCH! 29. EXAMPLE 30. EXAMPLE 31. EXAMPLEMoving on. 32. EXAMPLE 33. EXAMPLENow the box has reached the end of the lineof numbers.It will go back to the beginning and restartthe process 34. EXAMPLE 35. EXAMPLEWRONG ORDER!SWITCH! 36. EXAMPLE 37. EXAMPLE 38. EXAMPLEMoving on. 39. EXAMPLE 40. EXAMPLEWRONG ORDER!SWITCH! 41. EXAMPLE 42. EXAMPLEMoving on. 43. EXAMPLE 44. EXAMPLEWRONG ORDER!SWITCH! 45. EXAMPLE 46. EXAMPLEMoving on. 47. EXAMPLE 48. EXAMPLEWRONG ORDER!SWITCH! 49. EXAMPLE 50. EXAMPLEMoving on. 51. EXAMPLE 52. EXAMPLEHEY its already in the rightorder! No need to change. 53. EXAMPLE 54. EXAMPLEHEY its already in the rightorder! No need to change. 55. EXAMPLE 56. EXAMPLEWRONG ORDER!SWITCH! 57. EXAMPLE 58. EXAMPLEMoving on. 59. EXAMPLE 60. EXAMPLEHEY its already in the rightorder! No need to change. 61. EXAMPLE 62. EXAMPLEHEY its already in the rightorder! No need to change. 63. EXAMPLE 64. EXAMPLEHEY its already in the rightorder! No need to change. 65. EXAMPLE 66. EXAMPLEWRONG ORDER!SWITCH! 67. EXAMPLE 68. EXAMPLEMoving on. 69. EXAMPLE 70. EXAMPLEHEY its already in the rightorder! No need to change. 71. EXAMPLE 72. EXAMPLEHEY its already in the rightorder! No need to change. 73. EXAMPLE 74. EXAMPLEHEY its already in the rightorder! No need to change. 75. EXAMPLE 76. EXAMPLEHEY its already in the rightorder! No need to change. 77. EXAMPLEYAY WERE DONE! 78. Links Usedhttp://stackoverflow.com/questions/276113/what-is-a-bubble-sort-good-forhttp://www.stoimen.com/blog/2012/02/20/computer-algorithms-bubble-sort/http://vimeo.com/4315697http://www.algolist.net/Algorithms/Sorting/Bubble_sort </p>