What are the correct intermediate steps of the following data set when it is being sorted with the bubble sort? 15, 20, 10, 18
A. 15,10,20,18 -- 15,10,18,20 -- 10,15,18,20
B. 10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20
C. 15,20,10,18 -- 15,10,20,18 -- 10,15,20,18 -- 10,15,18,20
D. 15,18,10,20 -- 10,18,15,20 -- 10,15,18,20 -- 10,15,18,20

Respuesta :

Answer:

A. 15,10,20,18 -- 15,10,18,20 -- 10,15,18,20

Step-by-step explanation:

Bubble sorting can be defined as a technique or methodology whereby numbers that are not in their proper order are sorted into proper order that is from smallest to highest( increasing to decreasing order).

The method of bubble sorting involves the shuffling or swapping of adjacent numbers until the numbers are well sorted or arranged.

In the above question, we were given, a set of numbers:

15, 20, 10, 18

Step 1

20 is adjacent to 10

20 > 10

hence we swap

= 15,10,20,18

Step 2

From, 15,10, 20,18

20 is adjacent to 18

20 > 18

hence we swap

= 15,10,18,20

Step 3

From step 2, which gave us 15,10,18,20

15 us adjacent to 10

15 > 10

We swap

= 10,15,18,20

Hence,

15, 20, 10, 18 -- 15,10,20,18 -- 15,10,18,20 -- 10,15,18,20

Therefore, Option A is the correct option.

The correct intermediate steps of data 15, 20, 10, 18 set when it is being sorted with the bubble sort is; Choice A: 15,10,20,18 -- 15,10,18,20 -- 10,15,18,20.

Definition;

Bubble sort, otherwise termed the sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.

With emphasis on the word adjacent, it is evident Choice A is the correct intermediate steps of the data set 15, 20, 10, 18 when it is being sorted with the bubble sort.

Read more:

https://brainly.com/question/15148294