00:01
Okay, so we're going to do the implementation in python.
00:03
Here i have this script.
00:05
You're going to load the packages, head cube, so the key, pq, and collections you import default tick and counter.
00:17
Okay, so this is the class halfman node.
00:20
So this is a noise structure for halfman tree, and then this is the comparison operator.
00:29
And then here we have the function to build the halfman node.
00:32
So you create a priority queue from the frequency dictionary.
00:40
Priority q and then you go through the loop.
00:46
So in the loop you pop two heads with the smallest frequency and then merge the noise and then push the march noise back into the priority queue and then you return priority queue at the 0.
01:04
And here we have the function to generate half -man coils.
01:08
And so if node is known, then you just return no...