Commit a65ec129 authored by Romain Andres's avatar Romain Andres
Browse files

bloqué car je comprends r au hash key

parent fc591658
Loading
Loading
Loading
Loading
+25 −0
Changes for src/bst.c: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -18,19 +18,44 @@ typedef struct bst_t {
} bst_t;

bst_t bst_empty(void) {
  bst_t t;
	t.size = 0;
	t.tree = NULL;
	return t;

}

int bst_is_empty(bst_t t) {
  return t.size == 0;
}

bst_t bst_add(bst_t t, void* x) {
  struct node_t* arbre = t.tree;
  if (arbre == NULL) {
    //Alors on va créer un arbre
    struct node_t * newArbre = malloc(sizeof(struct node_t));
    newArbre->key = 1;  // hash(x) ?
    newArbre->val = x;
    newArbre->right = NULL;
    newArbre->left = NULL;
    t.tree = newArbre;
  } 
  else {
    //Sinon faut aller a droite ou a gauche jusqua trouver le bon emplacement
    while (arbre != NULL) {
      if ()
    }
  }
}

void bst_destroy(bst_t t, void (*free_void)(void*)) { 

}

int bst_in(bst_t t, void* x) {

}

unsigned long int bst_size(bst_t t) {

}
+96 B (7.14 KiB)

File changed.

No diff preview for this file type.

+48 B (33.3 KiB)

File changed.

No diff preview for this file type.

+40 B (29.4 KiB)

File changed.

No diff preview for this file type.

+40 B (34.5 KiB)

File changed.

No diff preview for this file type.