Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 3) procedure ArbEq (DonRes A:Arbre ,DonRes Fe:FEtudiant , DonRes n:entier)
- variable E : Etudiant;
- P : Arbre;
- Debut
- Si (n = 0) alors A <-- NIL;
- Sinon
- Allouer (p);
- Lire (Fe,E);
- P@.E <-- E;
- ArbEq(A@.gche,Fe,n/2);
- ArbEq(A@.dte,Fe,(n+1)-(2-1));
- Fin Si
- Fin
- 4) Parcours Infixé l'affichage
- Procedure Afficher (DonRes A: Arbre)
- debut
- Si (A<>NIL) Alors
- Afficher (A@.gche);
- Ecrire (A@.E.nom);
- Ecrire (A@.E.prenom):
- Afficher (A@.dte);
- Fin Si
- Fin
- 5) Fonction CreAbr (DonRes A:Arbre) : Arbre
- Variable R: Arbre;
- Debut
- Si (A<>NIL) Alors
- CreAbr <-- CreaAbr(A@.gche)
- InsAbr(R,A@.E)
- CreAbr <-- CreAbr(A@.dte);
- Fin Si
- fin
- 5.1) Procedure InsArb (DonRes A: Arbre, x : Etudiant)
- variable q : Arbre
- Debut
- Si (A = NIL) alors
- Allouer(q)
- q@.E <-- x
- q@.gche<-- NIL
- q@.dte <-- NIL
- P<--q
- Sinon
- Si (x.moy > P@.E.moy) alors
- InsAbr(P@.dte,x)
- Sinon
- InsAbr(P@.gche,x)
- FinSi
- Fin
- 6) Affichage / Order Moyenne
- Procedure AfficheMoy(DonRes A: Arbre)
- debut
- Si (A<>Nil) Alors
- AfficheMoy(A@.dte)
- ecrire(A@.E.ide,A@.E.moy)
- AfficheMoy(A@.gche)
- FinSi
- fin
- 7) Algorthme principal
- Algorithme Menugen
- variable x: entier
- Fe : FEtudiant
- A,Abr : Arbre
- debut
- Ecrire ('Le nbr d'etudiant est = ',nbret(Fe))
- x <-- nbret(Fe)
- ouvrir (Fe,lec)
- ArbEq (A,x,Fe)
- Abr <-- CreAbr (A)
- AfficheMoy (Abr)
- Fermer(Fe)
- Fin
- 8) Type
- Liste = @cellule
- cellule = enregistrement
- info : entier
- suiv : Liste
- File = enregistrement
- tete : Liste
- queue : Liste
- Procedure Crefles(DonRes A: Arbre, Res F1:File , Res F2 : File)
- debut
- Si (A<> NIL)
- Alors
- Crefiles (A@.gche,F1,F2)
- Si (A@.E.moy >=10 )
- Alors Crefiles (F1, A@.E.moy)
- Sinon
- Enfiler (F2,A@.E.moy)
- FinSi
- Crefiles (A@.dte,F1,F2)
- FinSi
- Fin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement