Esempio n. 1
0
//Désalloue tout les noeuds de l'arbre a
void detruit (arbre *a)
{
	if (*a!=NULL)
	{
		detruit (&(*a)->gauche);
		detruit (&(*a)->droit);
		free(*a);
		*a = NULL;
	}
}
Esempio n. 2
0
File: main.c Progetto: yoanlcq/ideas
int main(int argc, char *argv[]) {
    size_t i;
    HashTable *h = alloue(13);

    for(i=0; i<50; ++i)
        insere(i, h);

    affiche(h);
    insere(16, h);
    insere(27, h);
    insere(256, h);
    insere(30, h);

    affiche(h);

    if(appartient(27, h))
        puts("27 appartient à la table de hachage.");
    else
        puts("27 n'appartient pas à la table de hachage.");

    supprime(256, h);
    supprime(23, h);

    for(i=0; i<30; ++i)
        supprime(i, h);
    affiche(h);

    detruit(&h);
    affiche(h);

    return EXIT_SUCCESS;
}
Esempio n. 3
0
    void archive_options_read::clear()
    {

	    // setting the default values for all options

	detruit();

	x_crypto = crypto_none;
	x_pass.clear();
	x_crypto_size = default_crypto_size;
	x_input_pipe = "";
	x_output_pipe = "";
	x_execute = "";
	x_info_details = false;
	x_lax = false;
	x_sequential_read = false;
	x_slice_min_digits = 0;
	x_entrepot = new (get_pool()) entrepot_local("", "", false); // never using furtive_mode to read slices
	if(x_entrepot == NULL)
	    throw Ememory("archive_options_read::clear");
	x_ignore_signature_check_failure = false;
	x_multi_threaded = true;

	    //
	external_cat = false;
	x_ref_chem = default_ref_chem;
	x_ref_basename = "";
	x_ref_crypto = crypto_none;
	x_ref_pass.clear();
	x_ref_crypto_size = default_crypto_size;
	x_ref_execute = "";
	x_ref_slice_min_digits = 0;
	x_ref_entrepot = new (get_pool()) entrepot_local("", "", false); // never using furtive_mode to read slices
	if(x_ref_entrepot == NULL)
	    throw Ememory("archive_options_read::clear");
    }
Esempio n. 4
0
	~header_version() { detruit(); };
Esempio n. 5
0
	const header_version & operator = (const header_version & ref) { detruit(); copy_from(ref); return * this; };
Esempio n. 6
0
int main()
{
	arbre a,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9;

	tmp1 = (arbre)malloc(sizeof(struct noeud));
	tmp1->val = 1;
	tmp1->gauche = NULL;
	tmp1->droit = NULL;

	tmp2 = (arbre)malloc(sizeof(struct noeud));
	tmp2->val = 3;
	tmp2->gauche = NULL;
	tmp2->droit = NULL;

	tmp3 = (arbre)malloc(sizeof(struct noeud));
	tmp3->val = 7;
	tmp3->gauche = NULL;
	tmp3->droit = NULL;

	tmp4 = (arbre)malloc(sizeof(struct noeud));
	tmp4->val = 9;
	tmp4->gauche = NULL;
	tmp4->droit = NULL;

	tmp5 = (arbre)malloc(sizeof(struct noeud));
	tmp5->val = 2;
	tmp5->gauche = tmp1;
	tmp5->droit = tmp2;

	tmp6 = (arbre)malloc(sizeof(struct noeud));
	tmp6->val = 6;
	tmp6->gauche = NULL;
	tmp6->droit = tmp3;

	tmp7 = (arbre)malloc(sizeof(struct noeud));
	tmp7->val = 10;
	tmp7->gauche = tmp4;
	tmp7->droit = NULL;

	tmp8 = (arbre)malloc(sizeof(struct noeud));
	tmp8->val = 4;
	tmp8->gauche = tmp5;
	tmp8->droit = NULL;

	tmp9 = (arbre)malloc(sizeof(struct noeud));
	tmp9->val = 8;
	tmp9->gauche = tmp6;
	tmp9->droit = tmp7;

	a = (arbre)malloc(sizeof(struct noeud));
	a->val = 5;
	a->gauche = tmp8;
	a->droit = tmp9;


	printf("La hauteur de 10 est %d\n",hauteur(a,10));
	printf("Taille de l'arbre a = %d\n",taille(a));
	
	printf("Affiche prefixe : ");
	affiche_prefixe (a);
	inserer (&a,1);
	printf("\n");
	printf("Affiche infixe  : ");
	affiche_infixe (a);
	inserer (&a,11);
	printf("\n");
	printf("Affiche suffixe : ");
	affiche_suffixe (a);
	printf("\n");

	printf ("Recherche de 2 = %d\n",recherche(a,2));
	printf ("Recherche de 12 = %d\n",recherche(a,12));
	printf ("Recherche de 2 = %d\n",recherche(a,5));
	printf ("Recherche de 12 = %d\n",recherche(a,0));
	
	detruit(&a);

	printf("Affiche suffixe : ");
	affiche_suffixe (a);
	printf("\n");
	
	return 0;

}
Esempio n. 7
0
        const storage & operator = (const storage & val)
	{  detruit(first); copy_from(val); return *this; };
Esempio n. 8
0
        ~storage()
	{  detruit(first); };
Esempio n. 9
0
	    // destructor
	~fichier_global() { detruit(); };
Esempio n. 10
0
	    // assignment operator
	const fichier_global & operator = (const fichier_global & ref) { detruit(); copy_parent_from(ref); copy_from(ref); return *this; };