fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. typedef struct node{
  5. int key;
  6. int size;
  7. struct node *left;
  8. struct node *right;
  9. }tree;
  10.  
  11. tree * insert(tree *root, int value){
  12. if(root == NULL){
  13. root = (tree *)malloc(sizeof(tree));
  14. root->key = value;
  15. root->left = root->right = 0;
  16. root->size = 1;
  17. return root;
  18. }
  19. if(value > root->key)
  20. root->right = insert(root->right, value);
  21. else
  22. root->left = insert(root->left, value);
  23. return root;
  24. }
  25.  
  26. int main(void){
  27. return 0;
  28. }
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
Standard output is empty