-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (25 loc) · 762 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import time
from implementations.implem1 import search
from implementations.implem import Searcher , Hasher
if __name__ == '__main__':
pat = input("quelle patterne rechercher? ")
texte = input("Le texte dans lequel recherchez")
# nombre premier
q = 101
# Function Call
print("Resultat avec l'algo fonctionnel :")
start = time.time()
print (search(pat, texte, q))
end = time.time()
timeT = end- start
print("time" , timeT,"s")
print("Resultat avec l'algo POO :")
#Function Call with POO
start = time.time()
hasher = Hasher(texte, q, len(pat))
hasher.calculHashes()# rempli le dictionnaire des hash
searcher = Searcher(hasher , pat)
print(searcher.searchPattern())
end = time.time()
timeT= end-start
print("time" ,timeT , "s")