All pastes #592654 Raw Edit

Unnamed

public java v1 · immutable
#592654 ·published 2007-06-27 21:41 UTC
rendered paste body
/**	 * To check if HT is empty or not.	 * 	 * @return true, if both subtrees are null	 */	public boolean isEmpty() {		return left == null && right == null;	}	/**	 * To check if HT is a leaf.	 * 	 * @return true, if actual HT is non-empty, but both subtrees are	 */	public boolean isLeaf() {		return !isEmpty() && left.isEmpty() && right.isEmpty();	}	public BitString[] encode(BitString[] codeTable, BitString path) {		if (isLeaf()) {			codeTable[name] = path;			return null;		}		right.encode(codeTable, path.append(true));		left.encode(codeTable, path.append(false));		return codeTable;	}