namanvats / cpalgorithms

Algorithms and Techniques for competitive programming
MIT License
17 stars 30 forks source link

cpp-generic-sort.cpp #23

Open himanshusharma89 opened 4 years ago

himanshusharma89 commented 4 years ago

You need to sort elements of an array where the array can be of following data-types: Integer, String, floating number. Your task is to complete the given two functions: sortArray() and printArray() Input: The input line contains T, denoting the number of test cases. Each test case contains 2 lines. The first line contains n(size of array) and q(type of array) separated by space. Below is the description of q. q = 1, means elements of the array are of integer type q = 2, means elements of the array are of string type q = 3, means elements of array are of floating digit type
The second line contains n elements of the array separated by space. Output: For each testcase in new line, print the elements in sorted form of given type of array separated by space. Constraints: 1 <= T <= 50 1 <= n <= 100 1 <= q <= 3