Java-.Selection and insertion sort  3.a    Show steps of selection sort for the given array. You may need to add more rows to the table.   Selection Sort Initial value 3 2 7 5 4 8 9 10 1 Search 0 . . . end 3 2 7 5 4 8 9 10 1 Swap index 0                   Search 1 . . . end                   . . .                                                                                                                                                               3.b    Show steps of insertion sort for the given array. You may need to add more rows to the table.   Insertion Sort Initial value 3 2 7 5 4 8 9 10 1 , first item is sorted 3 2 7 5 4 8 9 10 1 , first 2 items are sorted 2 3 7 5 4 8 9 10 1 . . .

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 15PE
icon
Related questions
Question

Java-.Selection and insertion sort 

3.a    Show steps of selection sort for the given array. You may need to add more rows to the table.

 

Selection Sort

Initial value

3

2

7

5

4

8

9

10

1

Search 0 . . . end

3

2

7

5

4

8

9

10

1

Swap index 0

 

 

 

 

 

 

 

 

 

Search 1 . . . end

 

 

 

 

 

 

 

 

 

. . .

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3.b    Show steps of insertion sort for the given array. You may need to add more rows to the table.

 

Insertion Sort

Initial value

3

2

7

5

4

8

9

10

1

, first item is sorted

3

2

7

5

4

8

9

10

1

, first 2 items are sorted

2

3

7

5

4

8

9

10

1

. . .

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

"3.a
Show steps of selection sort for the given array. You may need to add more rows
to the table.
Selection Sort
-Initial value
-Search 0... ende
Swap index 0
- Search 1...end
3
4
104
4
10
"3.b
Show steps of insertion sort for the given array. You may need to add more rows
to the table.
Insertion Sorta
Initial value
4
n = 1, first item is sorted
10
2
5
8
n = 2, first 2 items are sorted
10
54
4
8
104
1. 1. 1. 1. ↑. ↑. ↑. ↑. ↑. ↑. ↑. ↑.
1. 1. ↑. ↑. ↑. ↑. ↑. ↑. ↑. 1. 1.
Transcribed Image Text:"3.a Show steps of selection sort for the given array. You may need to add more rows to the table. Selection Sort -Initial value -Search 0... ende Swap index 0 - Search 1...end 3 4 104 4 10 "3.b Show steps of insertion sort for the given array. You may need to add more rows to the table. Insertion Sorta Initial value 4 n = 1, first item is sorted 10 2 5 8 n = 2, first 2 items are sorted 10 54 4 8 104 1. 1. 1. 1. ↑. ↑. ↑. ↑. ↑. ↑. ↑. ↑. 1. 1. ↑. ↑. ↑. ↑. ↑. ↑. ↑. 1. 1.
Expert Solution
steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning