Anonymous user
Huffman coding: Difference between revisions
m
→{{header|Objective-C}}
(wrote code using example described) |
|||
Line 2,951:
int freq;
}
-(
@property (nonatomic, readonly) int freq;
@end
Line 2,957:
@implementation HuffmanTree
@synthesize freq; // the frequency of this tree
-(
if (self = [super init]) {
freq = f;
Line 2,988:
}
@property (readonly) char value;
-(
@end
@implementation HuffmanLeaf
@synthesize value;
-(
if (self = [super initWithFreq:f]) {
value = c;
Line 3,006:
}
@property (readonly) HuffmanTree *left, *right;
-(
@end
@implementation HuffmanNode
@synthesize left, right;
-(
if (self = [super initWithFreq:l.freq+r.freq]) {
left = l;
|