Can you explain the time complexity of finding a three largest number in an array?
I have two solution in mind:
The first one is the naive one in which we can sort an array in O(n*log(n)) time and after that we just take the last three elements and return it.
The second one is just to sort the element up to 3 element using bubble sort so we can get three largest value on the right side and return the array . But my doubt is what is the time complexity according to you. From my point of view it is F(n) = 3n (neglecting the constants). Kindly let me know