set9_sol

# set9_sol - CS112 Spring 2011 Problem Set 9 Non-recursive...

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

CS112 Spring 2011: Problem Set 9 Non-recursive tree code and Huffman Coding ------------------------------------------------------------------------ 1. Problem Set 6, #2, was on finding all entries in a BST whose keys were in a given range. Re-implement that method /without using recursion/. public class BSTNode<T extends Comparable<T>> { T data; BSTNode<T> left, right; BSTNode(T data, BSTNode<T> left, BSTNode<T> right) { this.data = data; this.left = left; this.right = right; } } public class Stack<T> { public Stack() { . .. } public void push(T data) { . .. } public T pop() throws NoSuchElementException { . .. } public boolean isEmpty() { . .. } public int size() { . .. } } // Accumulates, in a given array list, all entries in a BST whose keys are in a given range // including both ends of the range - i.e. all entries x such that min <= x <= max. // The accumulation array list, result, will be filled with node data entries that make the cut.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

set9_sol - CS112 Spring 2011 Problem Set 9 Non-recursive...

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

View Full Document
Ask a homework question - tutors are online