Perform a bubble sort on the following unsorted list:
3 2 5 6 4 1
In each blank, enter the list after the given iteration. Put one space between each pair of numbers. Do not put commas or any other character in your response besides the numbers and spaces. Do not put a space at the beginning or end of your response.
1. What will the list be after the first iteration of bubble sort?
2. What will the list be after the second iteration of bubble sort?
3. What will the list be after the third iteration of bubble sort?
4. What will the list be after the fourth iteration of bubble sort?
5. What will the list be after the fifth iteration of bubble sort?

Respuesta :

tonb

Answer:

3 2 5 6 4 1

2 3 5 4 1 6

2 3 4 1 5 6

2 3 1 4 5 6

2 1 3 4 5 6

1 2 3 4 5 6

Explanation:

After each iteration, one more element at the end of the list is at its final position.

The bubble sort of the unsorted list after one iteration each is:

  1. 3 2 5 6 4 1
  2. 2 3 5 4 1 6
  3. 2 3 4 1 5 6
  4. 2 3 1 4 5 6

What is a Bubble Sort?

This refers to the simple sort algorithm that makes a sweep through a list to properly sort elements that are in improper order and loops until the list is sorted.

Hence, because one iteration is needed, there would be a new element added until the end of the list when they are all in their final position and no commas are used.

The complete answer is:

  • 5. 2 1 3 4 5 6
  • 6. 1 2 3 4 5 6

Read more about bubble sort here:

https://brainly.com/question/14944048

#SPJ2

ACCESS MORE
ACCESS MORE
ACCESS MORE
ACCESS MORE