Advertisement
Guest User

Untitled

a guest
May 26th, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. struct Node* restore_tree(struct Node *node, T_bit_file *bf, struct T_smart_byte *byte){
  2.     int bit = f_get_bit(bf);
  3.     printf("%d", bit);
  4.     if(bit){
  5.         for (int i = 0; i < 8; ++i) {
  6.             set_bit(byte, f_get_bit(bf), NULL);
  7.         }
  8.         struct Node* new_leaf = create_queue_item((char)byte->data, 0, NULL, NULL);
  9.         node->left = new_leaf;
  10.         if(node->right == NULL){
  11.             node->right = restore_tree(node->right, bf, byte);
  12.         }
  13.         return NULL;
  14.     }
  15.  
  16.     struct Node* new_node = create_queue_item(EOF, 0, NULL, NULL);
  17.     new_node->left = restore_tree(new_node, bf, byte);
  18.     new_node->right = restore_tree(new_node, bf, byte);
  19.     return new_node;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement