set9_sol

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

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

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

This document was uploaded on 11/01/2011 for the course 198 112 at Rutgers.

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 Right Arrow Icon
Ask a homework question - tutors are online