Monday, 12 September 2016

Huffman coding

Huffman coding
#include<iostream>
#include<map>
using namespace std;
map<char,int> a;
struct node{
char data;
struct node * left;
struct node * right;
};

int main()
{
struct node * root=NULL;
a.clear();
string s;
cin>>s;
for(int i=0;i<s.length();i++) a[s[i]]+=1;
for(map<char,int>::iterator i=a.begin();i!=a.end();i++){
cout<<i->first<<" "<<i->second<<endl;
}
return 0;
}

No comments:

Post a Comment

Troubleshooting in SQL

1. SSRS Error  Round () need to be done in  SQL itself  2. Default Date In SSRS  Start Date =CDate(Format(DateAdd("d",-50,Now()), ...