What Will Be The Time Complexity Of Given Codep Pre Langc #415
What will be the time complexity of given code?</p> <pre><code class="language-c"> #include <bits/stdc++.h> using namespace std; void convert(int a[], int n) { vector <pair<int, int> > vec; for (int i = 0; i < n; i++) vec.push_back(make_pair(a[i], i)); sort(vec.begin(), vec.end()); for (int i=0; i<n; i++) a[vec[i].second] = i; } void printArr(int a[], int n) { for (int i=0; i<n; i++) cout << a[i] << " "; } int main() { int arr[] = {10,8,2,5,7}; int n = sizeof(arr)/sizeof(arr[0]); convert(arr , n); printArr(arr, n); return 0; } </code></pre>
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
Sorting - Insertion Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.3
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - LSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes