Driver code
var arr1 = [ 5 , 6 , 1 , 2 , 3 , 4 ] ; var n1 = arr1 . length ; document . write ( " " + findMin ( arr1 , 0 , n1 - 1 ) + " " ) ; var arr2 = [ 1 , 2 , 3 , 4 ] ; var n2 = arr2 . length ; document . write ( " " + findMin ( arr2 , 0 , n2 - 1 ) + " " ) ; var arr3 = [ 1 ] ; var n3 = arr3 . length ; document . write ( " " + findMin ( arr3 , 0 , n3 - 1 ) + " " ) ; var arr4 = [ 1 , 2 ] ; var n4 = arr4 . length ; document . write ( " " + findMin ( arr4 , 0 , n4 - 1 ) + " " ) ; var arr5 = [ 2 , 1 ] ; var n5 = arr5 . length ; document . write ( " " + findMin ( arr5 , 0 , n5 - 1 ) + " " ) ; var arr6 = [ 5 , 6 , 7 , 1 , 2 , 3 , 4 ] ; var n6 = arr6 . length ; document . write ( " " + findMin ( arr6 , 0 , n6 - 1 ) + " " ) ; var arr7 = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ; var n7 = arr7 . length ; document . write ( " " + findMin ( arr7 , 0 , n7 - 1 ) + " " ) ; var arr8 = [ 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 ] ; var n8 = arr8 . length ; document . write ( " " + findMin ( arr8 , 0 , n8 - 1 ) + " " ) ; var arr9 = [ 3 , 4 , 5 , 1 , 2 ] ; var n9 = arr9 . length ; document . write ( " " + findMin ( arr9 , 0 , n9 - 1 ) + " " ) ;