Recursive Programs to find Minimum and Maximum elements of array | Function to print Minimum element using recursion ; If size = 0 means whole array has been traversed ; Driver Code
function findMinRec ( A , n ) { if ( n == 1 ) return A [ 0 ] ; return Math . min ( A [ n - 1 ] , findMinRec ( A , n - 1 ) ) ; } let A = [ 1 , 4 , 45 , 6 , - 50 , 10 , 2 ] ; let n = A . length ; document . write ( findMinRec ( A , n ) ) ;