Write an algorithm to find the first two largest numbers in an in array of integers. For example,given the input ⟨2, 3, 7,−4, 5, 1⟩, the algorithm should output 7 5. State precisely a loopinvariant for you algorithm. Prove that your loop invariant holds and hence conclude that youralgorithm works.Analyse the algorithm to find the upper bound for run time of the above algorithm.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here