Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp2 hachage
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tristan Tolentino
tp2 hachage
Commits
4fdf4060
Commit
4fdf4060
authored
2 months ago
by
Mamadou Diallo
Browse files
Options
Downloads
Patches
Plain Diff
modification de la fonction create_hash_table
parent
637d02db
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.idea/misc.xml
+4
-1
4 additions, 1 deletion
.idea/misc.xml
.idea/tp2-hachage.iml
+5
-2
5 additions, 2 deletions
.idea/tp2-hachage.iml
__pycache__/tp_2_miso_mphf.cpython-313.pyc
+0
-0
0 additions, 0 deletions
__pycache__/tp_2_miso_mphf.cpython-313.pyc
tp_2_miso_mphf.py
+21
-3
21 additions, 3 deletions
tp_2_miso_mphf.py
with
30 additions
and
6 deletions
.idea/misc.xml
+
4
−
1
View file @
4fdf4060
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.12 (notebook4)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"Black"
>
<option
name=
"sdkName"
value=
"Python 3.13 (tp2-hachage)"
/>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.13 (tp2-hachage)"
project-jdk-type=
"Python SDK"
/>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.idea/tp2-hachage.iml
+
5
−
2
View file @
4fdf4060
<?xml version="1.0" encoding="UTF-8"?>
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"inheritedJdk"
/>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/.venv"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/.venv1"
/>
</content>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.13 (tp2-hachage)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
<component
name=
"PyDocumentationSettings"
>
...
...
This diff is collapsed.
Click to expand it.
__pycache__/tp_2_miso_mphf.cpython-313.pyc
0 → 100644
+
0
−
0
View file @
4fdf4060
File added
This diff is collapsed.
Click to expand it.
tp_2_miso_mphf.py
+
21
−
3
View file @
4fdf4060
...
...
@@ -141,11 +141,29 @@ def create_hash_table(set_kmer, n):
>>>
all
(
kmer
in
tableau
for
kmer
in
set_kmer
)
True
"""
pass
# TODO modifier
# créer la mphf pour les kmers
def
MPH
(
kmer
):
# On peut pas hacher un set directement
return
hash
(
kmer
)
%
n
# une fonction MPH qui calcule un index pour chaque kmer
# initialiser un tableau de taille n (une liste)
# écrire les kmers aux adresses du tableau données par la mphf
# retourner le tableau et la mphf
tableau
=
[
None
]
*
n
for
kmer
in
set_kmer
:
index
=
MPH
(
kmer
)
initial_index
=
index
#Sauvegarde de l'index initial pour eviter une boucle infinie
#Recherche d'une case libre avec linear probing (résolution des collisions)
while
tableau
[
index
]
is
not
None
:
# écrire les kmers aux adresses du tableau données par la mphf
index
=
(
index
+
1
)
%
n
# on boucle à zero si on atteint la fin
if
index
==
initial_index
:
raise
RuntimeError
(
"
La table de achage est pleine. Essayez avec une taille plus grande.
"
)
tableau
[
index
]
=
kmer
#Insérer le k-mer
return
tableau
,
MPH
# retourner le tableau et la mphf
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment