Home / Expert Answers / Computer Science / example-input-6-5-3-2-1-6-4-example-output-3-5-2-3-5-1-2-3-5-1-2-3-5-6-1-2-3-4-5-6-nbsp-do-pa989

(Solved): Example Input: 6 5 3 2 1 6 4 Example Output: 3;5; 2;3;5; 1;2;3;5; 1;2;3;5;6; 1;2;3;4;5;6;   DO ...



Description In the first lab assignment, your job is to implement insertion-sort (Yes, this is just a warm-up, and the labs w

Example Input:

6
5
3
2
1
6
4

Example Output:

3;5;
2;3;5;
1;2;3;5;
1;2;3;5;6;
1;2;3;4;5;6;

 

DO NOT USE THIS CODE, IT DOESNT WORK:

\}

Description In the first lab assignment, your job is to implement insertion-sort (Yes, this is just a warm-up, and the labs will be increasingly difficult. So heads up!) Input structure The input starts with an integer number which indicates the number of elements (integers) to be sorted, \( n \). Then, the elements follow, one per line. Output structure Recall that Insertion Sort first sorts the first two elements (in non-decreasing order), then the first three elements, and so on. You are asked to output the snapshot of the array at the end of each iteration. More precisely, for each \( 2 \leq k \leq n \), output the first \( k \) elements (in non-decreasing order) in a separate line where each element is followed by ;. A new line is followed by an enter. Examples of input and output: Input 6 5 3 1 6 4 Output 3;5; \( 2 ; 3 ; 5 \); \( 1 ; 2 ; 3 ; 5 \); \( 1 ; 2 ; 3 ; 5 ; 6 ; \) \}


We have an Answer from Expert

View Expert Answer

Expert Answer


The requirement of this program is To read the set of integers from the user using arrays and then s
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe