Commit 5307ff3d456467c88df419e3737e62d172004c07
1 parent
1f2fb513
Inutile
Showing
1 changed file
with
0 additions
and
61 deletions
Show diff stats
tree.c~ deleted
... | ... | @@ -1,61 +0,0 @@ |
1 | -#include <stdio.h> | |
2 | -#include <stdlib.h> | |
3 | -#include <stdbool.h> | |
4 | - | |
5 | -typedef struct node* Node; | |
6 | - | |
7 | -typedef struct node { | |
8 | - char letter; | |
9 | - Node next[26]; | |
10 | - bool endWord; | |
11 | -}node; | |
12 | - | |
13 | -void mk_empty_tree(Node* Tree) | |
14 | -{ | |
15 | - *Tree = NULL; | |
16 | -} | |
17 | - | |
18 | -bool is_empty_tree(Node* Tree) | |
19 | -{ | |
20 | - return(*Tree==NULL); | |
21 | -} | |
22 | - | |
23 | -void init_tree(Node* Tree) | |
24 | -{ | |
25 | - if(is_empty_tree(Tree)) | |
26 | - { | |
27 | - *Tree = malloc(sizeof(Node)); | |
28 | - Tree->letter = '?'; | |
29 | - Tree->endWord = false; | |
30 | - for(int i=0; i<26; i++) | |
31 | - Tree->next[i] = NULL; | |
32 | - } | |
33 | -} | |
34 | - | |
35 | -void add_in_tree(Node Tree, char word[]) | |
36 | -{ | |
37 | - char letter = word[0]; | |
38 | - while(letter != '/0') | |
39 | - { | |
40 | - if(Tree->next[letter-'a']!=NULL) | |
41 | - Tree = Tree->next[letter-'a']; | |
42 | - else | |
43 | - { | |
44 | - Node new = NULL; | |
45 | - new = malloc(sizeof(Node)); | |
46 | - new->letter = letter; | |
47 | - for(int i=0; i<26; i++) | |
48 | - { | |
49 | - new->next[i]=NULL; | |
50 | - } | |
51 | - Tree->next[letter-'a'] = new; | |
52 | - } | |
53 | - } | |
54 | - | |
55 | -} | |
56 | - | |
57 | - | |
58 | -int main(int argc, char argv[]) | |
59 | -{ | |
60 | - return 0; | |
61 | -} |