Skip to content
Snippets Groups Projects
Commit b453f695 authored by University's avatar University
Browse files

Étude du facteur de charge

parent 04a9bd8e
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,26 @@ def experiment_load_factor(load_factors):
"""
Étude du facteur de charge
"""
return [],[],[]
insertion_times = []
resizing = []
memory_sizes = []
for i in load_factors:
d = {}
start_time = time.perf_counter()
resizing_count = 0
last_memory_size = sys.getsizeof(d)
num_elements = int(i*100)
for j in range(num_elements):
d[j] = j
current_memory_size = sys.getsizeof(d)
if current_memory_size != last_memory_size :
resizing_count += 1
last_memory_size = current_memory_size
end_time = time.perf_counter()
insertion_times.append( end_time - start_time)
resizing.append(resizing_count)
memory_sizes.append(last_memory_size)
return insertion_times, resizing, memory_sizes
def experiment_longest():
"""
TODO: que fait cette fonction
......
......@@ -7,7 +7,7 @@ import random
###### PARTIE 1 ######
def construction_mphf(set_kmer:set[str], n:int, gamma:float=2, nb_niveaux:int=3) -> list[list[int]]:
def construction_mphf(set_kmer:set[str], n:int, gamma:float=100, nb_niveaux:int=100) -> list[list[int]]:
"""
Construit une fonction de hachage minimale parfaite (MPHF) pour un ensemble de k-mers.
......@@ -85,8 +85,7 @@ def get_hash_mphf(mphf, kmer):
mphf (list): Table de hachage minimale parfaite.
kmer (str): K-mer à hasher.
Returns:
int: Hash du k-mer.
Returns: int: Hash du k-mer.
Examples:
>>> set_kmer = {str(i) for i in range(10)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment