Created
June 22, 2012 08:56
-
-
Save obstschale/2971468 to your computer and use it in GitHub Desktop.
Print a binary tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void padding ( char ch, int n ){ | |
int i; | |
for ( i = 0; i < n; i++ ) | |
putchar ( ch ); | |
} | |
void structure ( struct node *root, int level ){ | |
int i; | |
if ( root == NULL ) { | |
padding ( '\t', level ); | |
puts ( "~" ); | |
} else { | |
structure ( root->right, level + 1 ); | |
padding ( '\t', level ); | |
printf ( "%d\n", root->info ); | |
structure ( root->left, level + 1 ); | |
} | |
} | |
int main ( void ){ | |
struct node *tree = NULL; | |
/* ... */ | |
structure ( tree, 0 ); | |
/* ... */ | |
} |
To be honest, I have no idea. This is over 7 years old ^^
But it seems i
is declared but not used in this function.
Yeah, I know.
I thought it would be nice to let you know.
I used your code to visualize my binary tree search.
Thanks,
Jakub
st 30. 10. 2019 v 14:36 odesílatel Hans-Helge Buerger <
[email protected]> napsal:
… To be honest, I have no idea. This is over 7 years old ^^
But it seems i is declared but not used in this function.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/2971468?email_source=notifications&email_token=AF2777O6ETVJLPVJWMOHEZ3QRGEVNA5CNFSM4JGWFBE2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF3L5A#gistcomment-3069904>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF2777LBCO4RAPKKFXLLS4TQRGEVNANCNFSM4JGWFBEQ>
.
void structure ( struct node *root, int level ){ int i;
what doesint i;
stand for?
It's useless.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
void structure ( struct node *root, int level ){ int i;
what does
int i;
stand for?