algorithms.tutorialhorizon.com

Find first two largest elements in a given array | Algorithms

Given an array of integers, write an algorithm to find the first two largest elements in the array. Example: Int [] a = { 6, 8, 1, 9, 2, 1, 10}; Output: 10, 9 Int [] a = { 6, 8, 1, 9, 2, 1, 10, 10}; Output: 10, 10