Javascript implementation of the approach
var INT_MAX = 1000000000 ; function min_element ( A , N ) { var min = A [ 0 ] ; var i ; for ( i = 1 ; i < N ; i ++ ) { if ( min > A [ i ] ) { min = A [ i ] ; } } return min ; }