algorithms.tutorialhorizon.com

Find three smallest elements in a given array | Algorithms

Objective: Given an array of integers, write an algorithm to find the three smallest elements in the array. Example: Int [] a = { 6, 8, 1, 9, 2, 10}; Output: 1, 2, 6 Int [] a = { 6, 8, 1, 9, 2, 1, 10, 10}; Output: 1, 1, 2 Int [] a = {6}; Output: Invalid Input, array size is less than 3