Blame view

treeh.h 583 Bytes
a4ef278c   bjeanlou   init withHash
1
2
3
4
5
6
  #ifndef TREEH_H
  #define TREEH_H
  
  #include <stdlib.h>
  #include <stdio.h>
  #include <string.h>
4043090f   bjeanlou   update2 withHash
7
  #include <stdbool.h>
a4ef278c   bjeanlou   init withHash
8
  
4043090f   bjeanlou   update2 withHash
9
  #define NBCHAR 27 //A-Z + '
a4ef278c   bjeanlou   init withHash
10
11
  
  
4043090f   bjeanlou   update2 withHash
12
  typedef struct _node node, *tree;
a4ef278c   bjeanlou   init withHash
13
14
  struct node{
    char letter;
4043090f   bjeanlou   update2 withHash
15
16
17
    bool isEnd;
    node* next[NBCHAR];
  };
a4ef278c   bjeanlou   init withHash
18
19
  
  tree make_empty_tree();
4043090f   bjeanlou   update2 withHash
20
21
22
23
24
25
26
  node* make_empty_node();
  node* make_node(char,bool);
  void delete_tree(tree);
  
  bool is_empty(tree);
  bool is_end(tree);
  bool is_followed(tree);//tells if tree has following letters
a4ef278c   bjeanlou   init withHash
27
28
29
30
31
  
  void addto_tree(tree,char*,int);
  void loadfrom_file(tree,FILE*);
  void loadfrom_keyboard(tree);
  
a4ef278c   bjeanlou   init withHash
32
33
34
35
36
37
  
  int hash(char);
  
  
  
  #endif //TREEH_H