Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include "bst.h"
- void indent(int x, int key){
- if (x == 0){ printf("%d\n", key); }
- else { printf (" ");
- indent(x-1, key);
- }
- }
- void printbst(BST t, int x){
- if (t == NULL){ printf(""); }
- else{
- printbst(BSTright(t), (x + 1));
- indent(x, BSTkey(t));
- printbst(BSTleft(t), (x + 1));
- }
- }
- int main(void){
- BST x = BSTmake(2, (BSTmake( 1, NULL, NULL)), (BSTmake(3, NULL,NULL)));
- BST y = insertbst(4, x);
- printbst(y,0);
- BSTdestroy(y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement