c++ - Frequency of alphabets repeated are not calculated properly -
I am trying to read an instance from a file to create a Hoffman tree. I am able to do this, but there is a problem. The problem is that I am using loops i and j for two but I want to output the output like this: I mean that I have removed this zero from memory allocation (I am accumulating them in sim [] and freak []. Help (any language c or c ++) The input frequency given to it is as follows: Abacquocated which is data [index]. Symbol is: < Strong> Everything is OK except "0". Please help me delete "0". Just before In addition, and at the place where the alphabet repeats at that place, it shows "0". I believe the alphabet is
"aababccc" the output is:
a = 3, a = 0, b = 2, a = 0, b = 0, C = 3, c = 0, c = 0
a = 3, b = 2, C = 3
favicon flag [256]; int j = 0; four sim [256]; for integer [256]; I = 0; i & lt; gin Ii ++) flag [i] = {0}; int fcount1 = 0; sym [i] = data [i] .symbol; freak [ii] = abcount 1; fcount1 = 0;}}
j loop, add a condition:
if (flag [i] == 0)
storeym and
storefreq speed The vectors and Pus_bak
int flag [256]; // To use this flag, know that the alphabet has already been counted or not. If it is assumed that I'm setting it according to "1" according to the second, then it is "0". Please see below in my code j int = 0, i; Std :: vector & lt; Four & gt; Storesym; Std :: vector & lt; Integer & gt; Storefreq; For (i = 0; i <; count; i ++) flag [i] = {0}; Int fcount1 = 0; (I = 0; i
Comments
Post a Comment