Question: CSCI-311 Training Insertion, Partition, Quicksort, Mergesort Problem 1. Given the code for insertion sort and a vector v with integers, show the content of the

CSCI-311 Training Insertion, Partition, Quicksort, Mergesort Problem 1. Given the code for insertion sort and a vector v with integers, show the content of the vector v after each iteration of the for loop (i.e. after iteration with i = 1, then after iteration when i = 2, ...). I showed an example of what is expected the content of v after the first iteration with i = 1. void insertion(vector int> &v){ v at the beginning int size = v.size(); 14 9 15 12 8 for(int i = 1; i = 0 && v[j] > key){ v[j+1] = v[j]; v after the iteration i = 2 --; }//while v[j+1] = key; v after the iteration i = 3 }//for }//insertion v after the iteration i = 4 BAA 3 4 8 Problem 2. Given the code for partition function, run partition on the given array A below, show A after each iteration of while loop (that starts at line 4 and ends at line 16): 1 int partition (vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
