Find two smallest elements in an unsorted array using only one pass i.e. O(n)
Utilisateur anonyme
Initialize two variables which will the first and second elements in the array respectively. As you loop, if current value is less than both then update both, if it's between the two then only update second.