diff --git a/tp_2_miso_mphf.py b/tp_2_miso_mphf.py
index ebc3d3328dd4c33b1c29a5692f95b319518eb291..f735a5c059e923e5f086f794efeb58c746cf327c 100644
--- a/tp_2_miso_mphf.py
+++ b/tp_2_miso_mphf.py
@@ -32,50 +32,69 @@ def construction_mphf(set_kmer, n, gamma=2, nb_niveaux=3):
 	>>> len(mphf) == n
 	True
 	"""
-	# Initialisation
-	set_kmer_courant = set_kmer.copy()
-	tableaux = []
-	collision = set()
-	for _ in range(nb_niveaux):
-		if len(set_kmer_courant) > 0:
-			l = len(set_kmer_courant)
-			tableau_principal = [-1] * (gamma * l)
-			for kmer in set_kmer_courant:
-				pass # compléter
-				# hacher le k-mer (attention, hash() peut rendre des entiers signés, nous voulons des entiers positifs)
-				# récupérer l'adresse
-				# si le tableau principal est déjà rempli à l'adresse:
-					# mettre le kmer dans collision()
-					#sinon, écrire le hash à l'adresse dans le tableau principal
-
-			tableaux.append(tableau_principal) # expliquer
-			set_kmer_courant = collision.copy() # expliquer
-			collision = set() # expliquer
-
-	# Construction de la MPHF
-	mphf = [] 
-	grand_tableau = []
-	for tableau in tableaux:
-		grand_tableau.extend(tableau) # expliquer
-
-	rangs = []
-	max_rang = 0
-	i = 0
-	for kmer in set_kmer:
-		pass # compléter:
-		# hacher le kmer
-		# si le hash est dans le grand_tableau
-			# récupérer son index
-			# récupérer son rang (utiliser la fonction count())
-			# ajouter à la mphf [h, rang]
-			# mettre à jour max_rang
-
-	for kmer in set_kmer_courant: #gestion des collisions: expliquer les 3 lignes du dessous
-		max_rang += 1
-		h = abs(hash(kmer))
-		mphf.append([h, max_rang])
-	
-	return mphf
+	 # Initialisation
+    set_kmer_courant = set_kmer.copy()
+    tableaux = []
+    collision = set()
+    for _ in range(nb_niveaux):
+        if len(set_kmer_courant) > 0:
+            l = len(set_kmer_courant)
+            tableau_principal = [-1] * (gamma * l)
+            for kmer in set_kmer_courant:
+                hachage = abs(hash(kmer))  # positif
+                print(hachage)
+                adresse = hachage % len(tableau_principal)
+
+                if tableau_principal[adresse] != -1:  # Collision
+                    collision.add(kmer)
+                else:
+                    tableau_principal[adresse] = hachage  # Stocker le hachage
+
+            tableaux.append(tableau_principal)  # expliquer
+            set_kmer_courant = collision.copy()  # expliquer
+            collision = set()  # expliquer
+
+    # Construction de la MPHF
+    mphf = []
+    grand_tableau = []
+    for tableau in tableaux:
+        grand_tableau.extend(tableau)  # expliquer
+
+    rangs = []
+    max_rang = 0
+    count = 0
+    list_h_pos = []
+    for pos in range(len(grand_tableau)):
+        h_tab = grand_tableau[pos]
+        if h_tab != -1:
+            count += 1
+            list_h_pos.append((h_tab, count))
+    
+    col = []
+    h = abs(hash(kmer))
+    for k in kmer:
+        h = abs(hash(k))
+        ok = 0
+        for e in range(len(list_h_pos)):
+            if list_h_pos[e][0] == h:
+                ok +=1
+        if ok ==0:
+            col.append(h) 
+
+        # compléter
+    # hacher le kmer
+    # si le hash est dans le grand_tableau
+    # récupérer son index
+    # récupérer son rang (utiliser la fonction count())
+    # ajouter à la mphf [h, rang]
+    # mettre à jour max_rang
+
+    for kmer in set_kmer_courant:  # gestion des collisions: expliquer les 3 lignes du dessous
+        max_rang += 1
+        h = abs(hash(kmer))
+        mphf.append([h, max_rang])
+
+    return mphf
 
 
 def get_hash_mphf(mphf, kmer):