What Will Be The Output Of The Following Codep Pre Langc #417

What will be the output of the following code?</p> <pre><code class="language-c"> #include <bits/stdc++.h> using namespace std; void convert(int arr[], int n) { int temp[n]; memcpy(temp, arr, n*sizeof(int)); sort(temp, temp + n); unordered_map<int, int> map; int sort_index = 0; for (int i = 0; i < n; i++) map[temp[i]] = sort_index++; for (int i = 0; i < n; i++) arr[i] = map[arr[i]]; } void printArr(int arr[], int n) { for (int i=0; i<n; i++) cout << arr[i] << " "; } int main() { int arr[] = {3,5,2,4}; int n = sizeof(arr)/sizeof(arr[0]); convert(arr , n); printArr(arr, n); return 0; } </code></pre>

Online Quiz This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Miscellaneous - Co-ordinate Compression - Quiz No.1.


Similar question(s) are as followings:



Online Quizzes of gs122 Data Communication and Computer Network

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background