I was working with long int data and I was trying to determine the smallest element in an array. I know the traditional way of looping through the array to find the minimum. This question is to check if there are other ways to speed it up.
There are some properties of this array which could probably help us speed up things, but I am not sure how.
The array has exactly 8 long int integers. Everytime we call the function, we find a min from the array and the number is replaced by another number and we repeat this step. (at least 8 billion times)
I was thinking of remembering the second largest number somehow for next iteration (Since we will have compared them in the current iteration). Would this be useful compared to the linear implementation of going through the array?
Also sorting is allowed, but we have to somehow remember the original positions using a temporary array. Would this be more effective.
Also is it somehow possible to use SIMD to determine minimum on long ints? Even a millisecond speedup is useful as I am doing this operation billions of times.