Sum of Min and Max element of Array

I have to find the sum of Minimum and Maximum element from an Array.
In java , I had implemented as
java.util.Arrays.sort(a); System.out.println(a[0]+a[t-1]);
to solve the question which has been accepted. (To see full code:Link)
To Find Min+Max , which sorting technique should I have to use? Or Is In-built sorting sufficient?

java.util.Arrays.sort(a) uses quick sort which has the time complexity of O(NlogN).

1 Like