Skip to content

Instantly share code, notes, and snippets.

@RdlP
Created June 6, 2017 18:35
Show Gist options
  • Save RdlP/380c6022b197ddad28ca0a5503b17dd9 to your computer and use it in GitHub Desktop.
Save RdlP/380c6022b197ddad28ca0a5503b17dd9 to your computer and use it in GitHub Desktop.
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