Advertisement
EzGod

Scape Goat Tree

Jul 18th, 2016
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdbool.h>
  4.  
  5. typedef struct Node {
  6.     int data;
  7.     struct Node *left, *right;
  8. } Node;
  9.  
  10. struct Node *newNode(int value) {
  11.     Node *node = (Node*)malloc(sizeof(Node));
  12.     node->data = value;
  13.     node->left = node->right = NULL;
  14.     return node;
  15. }
  16.  
  17. unsigned int countNodes(Node *root) {
  18.     if (root == NULL) {
  19.         return 0;
  20.     }
  21.     return 1 + countNodes(root->left) + countNodes(root->right);
  22. }
  23.  
  24. void menu() {
  25.     printf("==================\n");
  26.     printf("= SCAPEGOAT TREE =\n");
  27.     printf("==================\n");
  28. }
  29.  
  30. int main(int argc, char * argv[]){ 
  31.     menu();
  32.     getchar();
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement