let indice_ming t =
	let min = ref t.(0) in
	let imin = ref 0 in
	for i=1 to (Array.length t) - 1 do
		if t.(i) <= !min then
			begin
			min := t.(i);
			imin := i
			end
	done;
	!imin;;

indice_ming [|1;5;3;2;-1;9|];;
[|1;5;3;2;-1;9|].(4);;

let premier_indice_minl t = 
	let i = ref 0 in
	let n = Array.length t in
	let continue = ref true in
	while !continue do
		if !i = (n - 1) then
			continue := false
		else if (!i = 0) then
			if (t.(!i) <= t.(!i + 1)) then
				continue := false
			else i := !i + 1
		else if (t.(!i) <= t.(!i - 1)) && (t.(!i) <= t.(!i + 1)) then
			continue := false
		else
			i := !i + 1
	done;
	!i;;
premier_indice_minl [|7;5;3;2;1;|];;

let indice_minl t = 
	let rec aux is ie =
		let k = (is + ie)/2 in
		if (ie - is) <= 1 then
			if t.(is) <= t.(ie) then
				is
			else ie
		else if t.(k) >= t.(k-1) then
			aux is (k - 1)
		else if t.(k) >= t.(k+1) then
			aux (k + 1) ie
		else
			k in
	aux 0 (Array.length t - 1);;
let t = [|0;1;2;3;4;|];;
indice_minl t;;
t.(indice_minl t);;