Presentation is loading. Please wait.

Presentation is loading. Please wait.

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,

Similar presentations


Presentation on theme: "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,"— Presentation transcript:

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 !!!


Download ppt "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,"

Similar presentations


Ads by Google