advertisement
var adpushup = window.adpushup || {};
adpushup.que = adpushup.que || [];
adpushup.que.push(function () {
if (adpushup.config.platform === "MOBILE") {
adpushup.triggerAd("90f55663-effd-4105-b1e7-29d86b526544");
} else if ((window.outerWidth <= 768) || (window.outerWidth == 0)) {
adpushup.triggerAd("90f55663-effd-4105-b1e7-29d86b526544");
}
});
#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));
sort(vec.begin(), vec.end());
for (int i=0; i<n; i++)
a[vec.second] = i;
}
void printArr(int a[], int n)
{
for (int i=0; i<n; i++)
cout << a << " ";
}
int main()
{
int arr[] = {10,8,2,5,7};
int n = sizeof(arr)/sizeof(arr[0]);
convert(arr , n);
printArr(arr, n);
return 0;
}
a) O(1)
b) O(n)
c) O(log n)
d) O(n log n)
What is the auxiliary space complexity of the given code?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What is the auxiliary space complexity of the given code?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!