HuffmanTree - } public Object getData() { return this.data;...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/*************************************************************************** HW4 - HuffmanTree.java Junghyun Kim ole2000@cs.uoregon.edu http://www.cs.uoregon.edu/~ole2000 ***************************************************************************/ * package ole2000; p public class HuffmanTree { protected Object data; protected int freq; protected String prefix; protected HuffmanTree parent; protected HuffmanTree leftChild; protected HuffmanTree rightChild; p public HuffmanTree(Object data, int freq, HuffmanTree leftChild, HuffmanTree rightChild) { this.data = data; // the arbitary alphabets. that is integtes from 1 to n this.freq = freq; // the freqency this.prefix = new String(""); // prefix code this.parent = null; this.leftChild = leftChild; this.rightChild = rightChild;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } public Object getData() { return this.data; } public int getFreq() { return this.freq; } public HuffmanTree getRightChild() { return this.rightChild; } public HuffmanTree getParent() { return this.parent; } public HuffmanTree getLeftChild() { return this.leftChild; } public void setParent(HuffmanTree parent) { this.parent = parent; } public void setPrefixCode(String prefix) { this.prefix = prefix; } public void setRightChild(HuffmanTree right_child) { this.rightChild = right_child; } } public void setLeftChild(HuffmanTree left_child) { this.leftChild = left_child; } public String getPrefixCode() { return prefix; } public int compareTo(HuffmanTree node) { HuffmanTree a = this; return node.freq - a.freq; } }...
View Full Document

This document was uploaded on 12/10/2009.

Page1 / 2

HuffmanTree - } public Object getData() { return this.data;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online