Successfully reported this slideshow.
Upcoming SlideShare
×

Bubble Sort

18,085 views

Published on

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Sex in your area is here: ♥♥♥ http://bit.ly/2ZDZFYj ♥♥♥

Are you sure you want to  Yes  No

Are you sure you want to  Yes  No

Are you sure you want to  Yes  No

Are you sure you want to  Yes  No

Bubble Sort

1. 1. Bubble SortBy: Yoo Lee & Gabrielle Ortiz Block 2A
2. 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. 3. When to Use Bubble SortNot much use in the real world, but is a great learning toolbecause it’s 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. 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. 5. EXAMPLELET’S MIX IT UP!!
6. 6. EXAMPLE
7. 7. EXAMPLE
8. 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. 9. EXAMPLE
10. 10. EXAMPLEWRONG ORDER!SWITCH!
11. 11. EXAMPLEThat’s better.
12. 12. EXAMPLEMoving on.
13. 13. EXAMPLEWRONG ORDER!SWITCH!
14. 14. EXAMPLEWRONG ORDER!SWITCH!
15. 15. EXAMPLE
16. 16. EXAMPLEMoving on.
17. 17. EXAMPLE
18. 18. EXAMPLE
19. 19. EXAMPLEWRONG ORDER!SWITCH!
20. 20. EXAMPLEWRONG ORDER!SWITCH!
21. 21. EXAMPLE
22. 22. EXAMPLEMoving on.
23. 23. EXAMPLE
24. 24. EXAMPLEWRONG ORDER!SWITCH!
25. 25. EXAMPLE
26. 26. EXAMPLEMoving on.
27. 27. EXAMPLE
28. 28. EXAMPLEWRONG ORDER!SWITCH!
29. 29. EXAMPLE
30. 30. EXAMPLE
31. 31. EXAMPLEMoving on.
32. 32. EXAMPLE
33. 33. EXAMPLENow the box has reached the end of the lineof numbers.It will go back to the beginning and restartthe process
34. 34. EXAMPLE
35. 35. EXAMPLEWRONG ORDER!SWITCH!
36. 36. EXAMPLE
37. 37. EXAMPLE
38. 38. EXAMPLEMoving on.
39. 39. EXAMPLE
40. 40. EXAMPLEWRONG ORDER!SWITCH!
41. 41. EXAMPLE
42. 42. EXAMPLEMoving on.
43. 43. EXAMPLE
44. 44. EXAMPLEWRONG ORDER!SWITCH!
45. 45. EXAMPLE
46. 46. EXAMPLEMoving on.
47. 47. EXAMPLE
48. 48. EXAMPLEWRONG ORDER!SWITCH!
49. 49. EXAMPLE
50. 50. EXAMPLEMoving on.
51. 51. EXAMPLE
52. 52. EXAMPLEHEY it’s already in the rightorder! No need to change.
53. 53. EXAMPLE
54. 54. EXAMPLEHEY it’s already in the rightorder! No need to change.
55. 55. EXAMPLE
56. 56. EXAMPLEWRONG ORDER!SWITCH!
57. 57. EXAMPLE
58. 58. EXAMPLEMoving on.
59. 59. EXAMPLE
60. 60. EXAMPLEHEY it’s already in the rightorder! No need to change.
61. 61. EXAMPLE
62. 62. EXAMPLEHEY it’s already in the rightorder! No need to change.
63. 63. EXAMPLE
64. 64. EXAMPLEHEY it’s already in the rightorder! No need to change.
65. 65. EXAMPLE
66. 66. EXAMPLEWRONG ORDER!SWITCH!
67. 67. EXAMPLE
68. 68. EXAMPLEMoving on.
69. 69. EXAMPLE
70. 70. EXAMPLEHEY it’s already in the rightorder! No need to change.
71. 71. EXAMPLE
72. 72. EXAMPLEHEY it’s already in the rightorder! No need to change.
73. 73. EXAMPLE
74. 74. EXAMPLEHEY it’s already in the rightorder! No need to change.
75. 75. EXAMPLE
76. 76. EXAMPLEHEY it’s already in the rightorder! No need to change.
77. 77. EXAMPLEYAY WE’RE DONE!