diff options
| author | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:05:53 +0200 |
|---|---|---|
| committer | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:05:53 +0200 |
| commit | 9fe033ea88c2f705ec18c232873d056e0c229d72 (patch) | |
| tree | 0647dc8c51610c7336c88c04de2068ea14b21e17 /sem_4/Algo/TP6/Tas.h | |
Initial commit
Diffstat (limited to 'sem_4/Algo/TP6/Tas.h')
| -rw-r--r-- | sem_4/Algo/TP6/Tas.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sem_4/Algo/TP6/Tas.h b/sem_4/Algo/TP6/Tas.h new file mode 100644 index 0000000..58dad9a --- /dev/null +++ b/sem_4/Algo/TP6/Tas.h @@ -0,0 +1,59 @@ +#ifndef TAS_H +#define TAS_H + +#include <iostream> +#include <sstream> + +#include "AB.h" + +typedef int indiceDansTableauSommet; + +class ArbreParfait +{ + public: + int IndicePremierSommetLibre; + int hauteur; + int* contenu; + void Echanger(indiceDansTableauSommet,indiceDansTableauSommet); + + public: + ArbreParfait(int); +// on passe la hauteur max de l'arbre, un arbre réduit à sa racine étant de hauteur 0 + + + int AjouteSommetArbreParfait(int); +// renvoie -1 si l'ajout a échoué + +bool SommetValide(indiceDansTableauSommet); + +indiceDansTableauSommet Racine(); +bool FeuilleP(indiceDansTableauSommet); +indiceDansTableauSommet Pere(indiceDansTableauSommet); +indiceDansTableauSommet FilsGauche(indiceDansTableauSommet); +indiceDansTableauSommet FilsDroit(indiceDansTableauSommet); + +void SupprimerArbreParfait(indiceDansTableauSommet); + +}; + + +class Tas : public ArbreParfait { + public: + Tas(int); + + void Remonter(indiceDansTableauSommet); + void Descendre(indiceDansTableauSommet); + + void SupprimerTas(indiceDansTableauSommet); + + void AjouterTas(int); + + int Supmin(); + + void DescendreRecursive(indiceDansTableauSommet indiceDansTas, AB S); + + AB TasVersAB(); + +}; + +#endif |
