# 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 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:

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.

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

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

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

53 95 7 Pass 4 53 97125 35 97 5

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