Question: Write a function in C++ that can sort arrays of types int, string, char, or double(use templates). Using any known sorting algorithm is prohibited(bubble sort,
Write a function in C++ that can sort arrays of types int, string, char, or double(use templates). Using any known sorting algorithm is prohibited(bubble sort, merge sort, insertion sort, etc). You are also restricted to using one stack and one queue, as well as returning the sorted array in a vector.
1. Design an algorithm to sort your array given the above restrictions. Write it as pseudo-code.
2. Write a function to sort your array.
3. In main(), test your function on arrays of string, char, and double. Print the sorted array on the screen.
Reminder: Using any other data structures than the ones listed above is prohibited. Make sure to print clear messages on what your program is returning.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
