public class BadFibonacciParameterException extends Exception { public BadFibonacciParameterException() { super(); } public BadFibonacciParameterException(String s) { super(s); } }
replaceElemAtRank
is O(n).
insertAfter(first(), 2)
S
should be (5, 2, 7, 8) instead of (5, 2, 3, 8).
[Dmitry Tumanov]
element(p)
by p.element()
.
public static int depth(SimpleTree tree, Position node) { if (tree.isRoot(node)) { return 0; } else { return (1 + depth(tree, tree.parent(node))); } }
public int height1(SimpleTree T) {
by
public static int height1(SimpleTree T) {
.
public int height2(SimpleTree T, Position v) {
by
public static int height2(SimpleTree T, Position v) {
.
T.height(w)
by height2(T,w)
.
public void preorderPrint(SimpleTree T, Position v) {
by
public static void preorderPrint(SimpleTree T, Position v) {
.
T.element(v)
by v.element().toString()
.
public void parentheticRepresentation(SimpleTree T, Position v) {
by
public static void parentheticRepresentation(SimpleTree T, Position v) {
.
public int totalSize(SimpleTree T, Position v) {
by
public static int totalSize(SimpleTree T, Position v) {
.
removeAboveExternal(v)
: generates an error if
v is an internal node or v = root()
.
public void removeAboveExternal(Position v)
by
public Object removeAboveExternal(Position v)
.
public void printExpression(BinaryTree T, Position v) {
by
public static void printExpression(BinaryTree T, Position v) {
.
removeAboveExternal
is O(n).
findElement
runs ..." by
"...the method insertItem
runs ...".
if (T.isEmpty()) { return NO_SUCH_KEY; } else {to deal with the empty dictionary.
return x_ / 10;
" by
"return x / 10;
".