I have to find 4 the biggest numbers in a const vector and return their positions. I want this code to have the best time and space complexity. My first idea is to copy this const vector into vector and bubble sort it 4 times. That gives me 4*N but i have to create a vector. Second idea is to put everything from this const vector into priority_queue. That gives me a N*log2(N) time complexity without creating another variables. The maximum of N is around 100.
Is there any other options to do it in the fastest and the least space-consuming way?
EDIT: It doesn't matter which one is the biggest, I just need to return position of this 4 items in the input vector.