Skip to content
Snippets Groups Projects
Select Git revision
  • main
1 result

bst.h

Blame
  • user avatar
    Matthieu Dien authored
    1657c766
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    bst.h 448 B
    #ifndef __BST__
    #define __BST__
    
    struct node_t {
      unsigned long int key;
      void* val;
      struct node_t* left;
      struct node_t* right;
    };
    
    typedef struct bst_t {
      unsigned long int size;
      struct node_t* tree;
    } bst_t;
    
    unsigned long int hash(void*);
    bst_t bst_empty(void);
    int bst_is_empty(bst_t);
    bst_t bst_add(bst_t, void*);
    void bst_destroy(bst_t, void (*free_void)(void*));
    int bst_in(bst_t, void*);
    unsigned long int bst_size(bst_t);
    
    #endif