diff --git a/Activity_Selection_474.cpp b/Activity_Selection_474.cpp new file mode 100644 index 0000000..c1400f5 --- /dev/null +++ b/Activity_Selection_474.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; + +bool comp(pairi,pairj){ +    return i.second>vec(11); +      cout<<"Start time of activities: "<>v; +      v.push_back(vec[0]); +      paircurrent=vec[0]; +      for(int j=1;j<11;j++){ +          if(vec[j].first > current.second){ +              v.push_back(vec[j]); +              current=vec[j]; +          } +      } +      vector>::iterator i; +      cout<<"\nFollowing activities are selected- "< 1: + (key1, c1) = nodes[-1] + (key2, c2) = nodes[-2] + nodes = nodes[:-2] + node = NodeTree(key1, key2) + nodes.append((node, c1 + c2)) + + nodes = sorted(nodes, key=lambda x: x[1], reverse=True) + +huffmanCode = huffman_code_tree(nodes[0][0]) + +print(' Char | Huffman code ') +print('----------------------') +for (char, frequency) in freq: + print(' %-4r |%12s' % (char, huffmanCode[char]))