day23 - COP 3503 Computer Science II CLASS NOTES - DAY #23...

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

View Full Document Right Arrow Icon
COP 3503 – Computer Science II CLASS NOTES - DAY #23 Huffman Coding Tree public class HuffNode { protected boolean children; protected char root; protected HuffNode left; protected HuffNode right; public HuffNode ( ) { children = false; root = null; left = null; right = null; } // end constructor public HuffNode (char in, HuffNode lef, HuffNode rig) { children = true; root = in; left = lef; right = rig; } // end constructor } // end HuffNode public class Hufflist { protected HuffNode head; protected HuffNode current; protected String answer; public HuffList ( ) { head = new HuffNode ( ); current = head; answer = new String ( ); } // end constructor Day 23 - 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
public void insertAll (char[ ] alpha) { for (int i = 0; i < 26; i++) { HuffNode temp = new HuffNode (alpha[i], null, null) if ((i % 2) == 0) { current.left = temp; } else{ current.right= temp; current = getNextParent ( ); } //end else } //end for current = head; } // end insertAll public boolean find (HuffNode h, char c) { if (h.root == c) return true;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/22/2009 for the course COP 3503c taught by Professor Staff during the Spring '08 term at University of Central Florida.

Page1 / 6

day23 - COP 3503 Computer Science II CLASS NOTES - DAY #23...

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

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