Created
June 6, 2017 18:35
-
-
Save RdlP/380c6022b197ddad28ca0a5503b17dd9 to your computer and use it in GitHub Desktop.
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 print_tree(Node *root){ | |
if (root->left){ | |
memcpy(root->left->code, root->code, root->depth); | |
root->left->code[node->depth] = 1; | |
print_tree(root->left); | |
} | |
if (root->right){ | |
memcpy(root->right->code, root->code, root->depth); | |
root->right->code[node->depth] = 1; | |
print_tree(root->right); | |
} | |
if (!root->left && !root->right){ | |
printf("0x%02X (%c): ", root->symbol, root->symbol); | |
printArr(result, root->depth); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment