Bubble sort

Published on
Scene 1 (0s)

close up of circuit board

Bubble sort

By Khanyisile kobo & elona seti

Scene 2 (9s)

close up of circuit board

What is bubble code ?

Bubble sort, sometimes referred to as sinking sort A bubble sort is an internal exchange sort. It is considered one of the simplest methods to sort an array of objects.

Scene 3 (25s)

Who invented the bubble sort?

Iverson The term “Bubble Sort” was first used by Iverson in 1962.

Scene 4 (35s)

Why is it called Bubble Sort?

Why bubble sort is called “bubble” sort? The “bubble” sort is called so because the list elements with greater value than their surrounding elements “bubble” towards the end of the list. For example, after first pass, the largest element is bubbled towards the right most position.

Scene 5 (53s)

What does bubble sort do ?

R epeatedly steps through the list, compares adjacent elements and  swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.

Scene 6 (1m 8s)

Why do we use ?

We use bubble sort to chronologically sort a list of values in ascending order . It has the same level of efficiency as selection sort . Bubble Sort is a sorting algorithm that works by repeatedly stepping through lists that need to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. This passing procedure is repeated until no swaps are required, indicating that the list is sorted.

Scene 7 (1m 33s)

Biggest Advantage of a Bubble Sort

One of the main advantages of a bubble sort is that it is a very simple algorithm to describe to a computer. There is only really one task to perform (compare two values and, if needed, swap them). This makes for a very small and simple computer program .

Scene 8 (1m 52s)

How to use bubble sort

First we get the unsorted arrays Then the Bubble sort starts with very first two elements, comparing them to check which one is greater. If the first array is is greater then we swap the arrays and continue that process until the largest value is at the end Then the loop starts from the beginning then sorts and repeats until the arrays are in ascending order.

Scene 9 (2m 15s)

Example code

public void bubbleSort (int[]array) for(int i =0;i< array.length;i ++) for(int j=1;j<( i-i ); j++ ) if ( arr [j-1]> arr [j])

Scene 11 (3m 56s)

Thank you <3