daily pastebin goal
10%
SHARE
TWEET

huffman

a guest Mar 21st, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. vector<bool> code;                
  2. map<char,vector<bool> > table;    
  3.  
  4. void BuildTable(Node *root)
  5. {  
  6.     if (root->left!=NULL)
  7.                       { code.push_back(0);
  8.                       BuildTable(root->left);}
  9.      
  10.     if (root->right!=NULL)
  11.                        { code.push_back(1);
  12.                        BuildTable(root->right);}
  13.    
  14.     if (root->left==NULL && root->right==NULL) table[root->c]=code;    
  15.    
  16.     code.pop_back();
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top