Question
I need this flipped to where it will print the currentVal in Descending order, Not Ascending. Thanks template void writeMiniVector(const miniVector& v) { for (int
I need this flipped to where it will print the "currentVal in Descending order", Not Ascending.
Thanks
template void writeMiniVector(const miniVector& v) { for (int i = 0; i < v.size(); i++) cout << " " << v[i];
cout << endl << endl; } // use insertion sort to place miniVector v to place in a descending order template void sortMiniVector(miniVector& v) { int i, j, currentVal; for (i = 1; i < v.size(); i++) { currentVal = v[i]; j = i - 1;
///compare with each previous element and swap if previous is greater than the one before while (j >= 0 && v[j] > currentVal) { v[j + 1] = v[j]; j = j - 1; } v[j + 1] = currentVal; } } //end Unit3-4Prog
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started