Blame view

treeh.h 577 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;
0bc3d1ad   bjeanlou   dico created
13
  struct _node{
a4ef278c   bjeanlou   init withHash
14
    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
0bc3d1ad   bjeanlou   dico created
27
  int hash(char);//need to check if isalpha
a4ef278c   bjeanlou   init withHash
28
  
c6a94513   bjeanlou   treeh.ch OK
29
30
  void addto_tree(tree,string,int);
  void addto_tree2(tree,string);
a4ef278c   bjeanlou   init withHash
31
  
a4ef278c   bjeanlou   init withHash
32
  
a4ef278c   bjeanlou   init withHash
33
  #endif //TREEH_H