LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   huffman algorithm (https://www.linuxquestions.org/questions/programming-9/huffman-algorithm-156361/)

mcshen 03-11-2004 12:37 PM

huffman algorithm
 
I am just wondering how one would find the priority(by the standard below) if he/she is given the frequency..

would priority = 1/frequency work?

higher frequency
10,9,8,7,6,5,4,3,2,1

higher priority
0,1,2,3,4,5,6,7,8,9


basically, higher Frequency(the number is bigger) -> Higer priority(number is smaller), so a priority of 0 will mean frequency of 10

wapcaplet 03-11-2004 12:45 PM

I'm not sure what you mean... priority and frequency of what?

If you're saying that:

frequency(10) = priority(0)
frequency(9) = priority(1)
...

then I guess subtract either one from 10 and you have the other.

mcshen 03-12-2004 01:50 PM

yes. that's what i mean. I will try that. thanks

Mohsen 03-12-2004 02:00 PM

Instead of doing that it's better trying to make the Huffman tree. It's quite easy. And do not need to be careful about priorities and frequencies.


All times are GMT -5. The time now is 04:47 PM.