Skip to content
Snippets Groups Projects
Commit 67326503 authored by Loic Scoth's avatar Loic Scoth
Browse files

fin modif

parent c3a1ef19
Branches
No related tags found
No related merge requests found
......@@ -33,15 +33,12 @@ graph {
"[22, 30]"
"[14]" -- "[22, 30]"
"[22, 30]"
"[18]"
"[22, 30]" -- "[18]"
"[18]"
"[16]"
"[18]" -- "[16]"
"[16]"
"[20]"
"[18]" -- "[20]"
"[20]"
"[]"
"[22, 30]" -- "[]"
"[]"
"[16, 18]"
"[]" -- "[16, 18]"
"[16, 18]"
"[26]"
"[22, 30]" -- "[26]"
"[26]"
......
src/ArbreB/Graph.gv.jpg

42.3 KiB | W: | H:

src/ArbreB/Graph.gv.jpg

40 KiB | W: | H:

src/ArbreB/Graph.gv.jpg
src/ArbreB/Graph.gv.jpg
src/ArbreB/Graph.gv.jpg
src/ArbreB/Graph.gv.jpg
  • 2-up
  • Swipe
  • Onion skin
File added
src/ArbreB/Graph2.gv.jpg

42.3 KiB

......@@ -101,6 +101,25 @@ class Btree() :
"""
(ok, _, _, _) = self.root.is_ArbreB(self.k, True)
return ok
def suppr(self, value, k):
"""
Supprimer une valeur dans l'arbre
Params :
value : (int), valeur à supprimer
k : (int), nombre de clés
Return :
#TODO
Exemple(s):
>>> arbreB = Btree(2, Node([5,25]))
>>> arbreB.suppr(25,2)
True
>>> arbreB
Btree(Node([5]))
"""
return self.root.suppression(value, k, True)
def __repr__(self) :
"""
......
......@@ -7,67 +7,48 @@ from BTree import Btree
class experimentation:
def __init__(self, exp):
self.btree = Btree(2, Node([]))
if exp == "1":
self.experimentationInsert1()
elif "2":
elif exp == "2":
self.experimentationSuppr1()
else :
None
elif exp == "3" :
self.experimentationInsert2()
def experimentationInsert1(self):
def experimentationInsert1(self):
self.btree = Btree(2, Node([]))
for n in [2, 4, 5] + list(range(6, 37, 2)) + [7, 9, 11, 13]:
self.btree.insertion(n)
Visualization(self.btree).render()
print("est un arbreB : " + str(self.btree.isBalance()))
print(self.btree)
def experimentationSuppr1(self):
self.btree = Btree(2, Node([]))
#non fonctionnel
print("Non fonctionnel")
for n in [2, 4, 5] + list(range(6, 37, 2)) + [7, 9, 11, 13]:
self.btree.insertion(n)
self.btree.suppr(20,2)
Visualization(self.btree).render()
#for n in [14,10,20,18,16,24,6]
print(self.btree)
def experimentationInsert2(self):
self.btree = Btree(10, Node([]))
for n in list(range(100000)):
self.btree.insertion(n)
#Visualization(self.btree).render()
print("est un arbreB : " + str(self.btree.isBalance()))
print(self.btree)
# fonction temporaire pour tester la correspondance des arbres de manière automatique et simple visuellement
# def isCorrect(self, BTreeTest):
# if (self.btree.equals(BTreeTest)):
# print("Correct")
# else:
# print("error")
if __name__ == "__main__":
response = input("Quelle expérimentation voulez vous (1 ou 2)")
experiment = experimentation(response)
# if __name__ == "__main__":
# import sys
# sys.path.insert(1, './src')
# sys.path.insert(2, '../src')
# from Node import *
#
# unittest.main()
# import doctest
# doctest.testmod(verbose=False)
\ No newline at end of file
response = input("Quelle expérimentation voulez vous (1: insertion1 / 2: suppression1 / 3: insertion3 )")
experiment = experimentation(response)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment