This page was exported from Enseignement de l'informatique et du numérique au lycée Boissy d'Anglas [ https://icn-isn-boissy.yj.fr/wp ] Export date:Thu May 16 5:27:08 2024 / +0000 GMT ___________________________________________________ Title: Corrigé exercice 3 les arbres --------------------------------------------------- Q1aNombre de nœuds = 7 (taille max pour une hauteur h : 2h - 1 = 1).Q1bprofondeur maximale du nœud racine = 4NB : par convention, ici un arbre réduit à un seul nœud est de hauteur 1Q2Taille : 7Hauteur : 3 (par convention h(Δ) = 1) Q3Taille : 7Hauteur : 4 Q4 def hauteur(self): return self.racine.hauteur() Q5 def taille(self) -> int: if self.gauche == None and self.droite == None: return 1 elif self.gauche == None: return 1 + self.droite.taille() elif self.droite == None: return 1 + self.gauche.taille() else: return 1 + self.gauche.taille() + self.droite.taille() def taille(self): return self.racine.taille() Q6a2(h-1) – 1 < taille ≤ 2h – 1doù t_min = 2(h-1) – 1 Q6b def bien_construit(self) -> bool: return 2**(self.racine.hauteur() - 1) - 1 < self.racine.taille() <= 2**self.racine.hauteur() - 1 --------------------------------------------------- Images: https://icn-isn-boissy.yj.fr/wp/wp-content/uploads/2022/10/image-1.png https://icn-isn-boissy.yj.fr/wp/wp-content/uploads/2022/10/image-2.png --------------------------------------------------- --------------------------------------------------- Post date: 2022-10-14 09:34:46 Post date GMT: 2022-10-14 07:34:46 Post modified date: 2022-10-14 09:38:07 Post modified date GMT: 2022-10-14 07:38:07 ____________________________________________________________________________________________ Export of Post and Page as text file has been powered by [ Universal Post Manager ] plugin from www.gconverters.com