diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-02-18 08:10:10 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-02-18 08:10:10 -0500 |
commit | b4dbd2cfa724476162fa6d35941a5d7cdc9c9524 (patch) | |
tree | 431af0b75efa29dfa3bab2868a78ab0eb29173c7 /CS2501/trees/tree0.c | |
parent | e8b1808eaf87a49e4c34ebbfb66854baa627418c (diff) |
Adds all assignments not previously in a git repo
Diffstat (limited to 'CS2501/trees/tree0.c')
-rwxr-xr-x | CS2501/trees/tree0.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/CS2501/trees/tree0.c b/CS2501/trees/tree0.c new file mode 100755 index 0000000..f9d6585 --- /dev/null +++ b/CS2501/trees/tree0.c @@ -0,0 +1,54 @@ +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + + +typedef struct node { + int id; + struct node *left; + struct node *right; +} treenode; + + +main (argc, argv, envp) +int argc; +char **argv, **envp; +{ + + treenode *a, *b, *c, *d, *z; + + z = malloc(sizeof(treenode)); + z->id = 'z'; + z->left = 0; + z->right= 0; + + d = malloc(sizeof(treenode)); + d->id = 'd'; + d->left = 0; + d->right= 0; + + c = malloc(sizeof(treenode)); + c->id = 'c'; + c->left = d; + c->right= z; + + b = malloc(sizeof(treenode)); + b->id = 'b'; + b->left = 0; + b->right= 0; + + a = malloc(sizeof(treenode)); + a->id = 'a'; + a->left = b; + a->right= c; + +/* manually create nodes to build this tree: + + a + / \ + b c + / \ + d z + +*/ +} |