Commit febc0130584f51dda6d14fb8d5600d6d7f1c1536
1 parent
f00fa1d1
suppression
Showing
1 changed file
with
0 additions
and
60 deletions
Show diff stats
projet0.c~ deleted
... | ... | @@ -1,60 +0,0 @@ |
1 | -#include <stdio.h> | |
2 | -#include <stdlib.h> | |
3 | - | |
4 | -#define A 26 | |
5 | - | |
6 | -struct node { | |
7 | - char lettre; | |
8 | - struct cell* listeLettre; | |
9 | -}; | |
10 | - | |
11 | -struct cell { | |
12 | - struct node* arbre; | |
13 | - struct cell* suivant; | |
14 | -}; | |
15 | - | |
16 | -void initialisation_tab_arbre(struct node tab[]) { | |
17 | - for(int i = 0; i < A; i++) { | |
18 | - tab[i].lettre = 97+i; //ajout lettres minuscules | |
19 | - } | |
20 | - /*for(int i = 0; i < 8; i++) { | |
21 | - tab[i+26].lettre = 130+i; //ajout caractères spéciaux | |
22 | - }*/ | |
23 | -} | |
24 | - | |
25 | -void ajout_tete(char elem, struct cell** pL) { | |
26 | - struct cell* p; | |
27 | - p = malloc(sizeof(struct cell)); | |
28 | - p->arbre = malloc(sizeof(struct node)); | |
29 | - p->arbre->lettre = elem; | |
30 | - p->suivant = *pL; | |
31 | - *pL = p; | |
32 | -} | |
33 | - | |
34 | -void insertion(char elem, struct cell** pL) { | |
35 | - if((*pL == NULL)||((*pL)->arbre->lettre > elem)) ajout_tete(elem, pL); | |
36 | - else if((*pL)->arbre->lettre == elem) return; | |
37 | - else insertion(elem, &(*pL)->suivant); | |
38 | -} | |
39 | - | |
40 | -/*void affiche_tab(struct node tab[]) { | |
41 | - for(int i = 0; i < 32; i++) { | |
42 | - printf("%c\n", tab[i].lettre); | |
43 | - } | |
44 | - }*/ | |
45 | - | |
46 | -void lire_fichier() { | |
47 | - | |
48 | -} | |
49 | - | |
50 | -int main() { | |
51 | - struct node tab_arbre[A]; | |
52 | - struct node Arbre; | |
53 | - char lettre; | |
54 | - Arbre.listeLettre = NULL; | |
55 | - initialisation_tab_arbre(tab_arbre); | |
56 | - scanf("%c", &lettre); | |
57 | - insertion(lettre, &(Arbre.listeLettre)); | |
58 | - //printf("lettre : %c\n", Arbre.listeLettre->arbre->lettre); | |
59 | - return 0; | |
60 | -} |