Обновить sk1/compressor.c

This commit is contained in:
Yevhen Kozirovskyi 2025-01-26 20:09:11 +00:00
parent 0c18bdde02
commit 2aa747983d

View File

@ -149,12 +149,13 @@ void generateCodes(HuffmanNode* root, char* arr, int top, char** codes) {
codes[root->data] = strdup(arr); codes[root->data] = strdup(arr);
} }
} }
void free_huffman_tree(Node* root) { void free_huffman_tree(HuffmanNode* root) {
if (!root) return; if (!root) return;
free_huffman_tree(root->left); free_huffman_tree(root->left);
free_huffman_tree(root->right); free_huffman_tree(root->right);
free(root); free(root);
} }
// Function to compress a file // Function to compress a file
int compress_1(const char* input_file, const char* output_file) { int compress_1(const char* input_file, const char* output_file) {
FILE* input = fopen(input_file, "rb"); FILE* input = fopen(input_file, "rb");