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

This commit is contained in:
Yevhen Kozirovskyi 2025-01-19 16:58:09 +00:00
parent e463e2d1b0
commit 4125b24356

View File

@ -133,7 +133,9 @@ void storeCodes(struct MinHeapNode* root, char** codes, char* currentCode, int t
}
if (!(root->left) && !(root->right)) {
currentCode[top] = '\0';
if (root->data < 256) { // Ensure data is within bounds
codes[root->data] = strdup(currentCode);
}
}
}
// Compress the input file using Huffman Coding