type t = (string*int) list array
	   
let hash w s = 
  let h = ref 0 in
  for i = String.length s - 1 downto 0 do 
    h := (19 * !h + Char.code s.[i]) mod w
  done;
  !h

(* ou avec une fonction récursive *)
let hash w s = 
  let n = String.length s in
  let rec loop i = 
    if i = n then 
      0 
    else 
      (19 * loop (succ i) + Char.code s.[i]) mod w
  in
  loop 0

(* ou enfin avec une fonction récursive terminale *)
let hash w s =
  let rec loop acc i = 
    if i = -1 then acc else loop ((19 * acc + Char.code s.[i]) mod w) (i - 1)
  in
  loop 0 (String.length s - 1)

let nouveau size = Array.make size []
		    
let trouve t s = List.assoc s t.(hash (Array.length t) s)
let ajoute t (s,e) = let h = hash (Array.length t) s in t.(h) <- (s,e)::t.(h)