Download presentation

Presentation is loading. Please wait.

Published byIsabell Templer Modified over 2 years ago

1
Decision Maths 1 Sorting Algorithms Bubble Sort A V Ali : www.2july-maths.co.uk 1.Start at the beginning of the data set. 2.Compare the first two elements, and if the first is greater than the second, swaps them. 3.Continue doing this for each pair of adjacent elements to the end of the data set. 4.Start again with the first two elements, repeating until no swaps have occurred on the last pass.

2
57 3 12 9 5 Bubble Sort Pass 1 57 31295 57 3 95 55 3 97 55 3 97 55 397

3
55 97 3 Pass 2 55 93127 55 93 7 55 93 7 55 97 3

4
55 93 7 Pass 3 55 97123 55 97 3 53 97 5

5
53 95 7 Pass 4 53 97125 35 97 5

6
35 95 7 Pass 5 35 97125 35 97 5 Sorted !!!

Similar presentations

OK

Discrete Math CSC151 Analysis of Algorithms. Complexity of Algorithms In CS it's important to be able to predict how many resources an algorithm will.

Discrete Math CSC151 Analysis of Algorithms. Complexity of Algorithms In CS it's important to be able to predict how many resources an algorithm will.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google