import java.util.*; public class TreeAB { /* ================================================= Variables ================================================= */ public int a; // lower bound on node size public int b; // upper bound on node size public Node root; // Root of the tree public Node searchEndPos; // Last node visited by findEntry() /* ================================================= Constructor ================================================= */ public TreeAB(int a, int b) { } /* ================================================================ keySearch(k): find entry containing key k Return value: e[i] if found (e[i].key == k) null if not found AND: searchEndPos = node last visited in search ================================================================ */ public Entry keySearch(String k) { } /* ================================================ get(k): return value associated with key k ================================================ */ public Integer get(String k) { } /* ================================================ put(k): insert (k,v) ================================================ */ public Integer put(String k, Integer v) { } /* ================================================= remove(k) ================================================= */ public Integer remove(String k) { } /* ================================================================== printTree(): print the tree (same format as 2,4-tree example) ================================================================== */ public void printTree() { } /* ================================================================== checkTree(): check the a,b-tree for consistency ================================================================== */ public void checkTree() { if ( b <= 0 ) { System.out.println("Error: Your constructor did not set the value b"); return; } error = false; checkSub( root ); // The real check alg. is recursive if ( error ) System.exit(1); System.out.println(); } public void checkSub (Node p) { int i; if ( p == null) return; // Check parent child relationship for node for ( i = 0; i < b; i++ ) if ( p.child[i] != null ) { if ( p.child[i].parent != p ) { printTree(); System.out.println("---------------------------"); System.out.println("Error:"); System.out.println("p: " + p); System.out.println("p.child[" + i + "] = " + p.child[i]); System.out.println("BUT: p.child[" + i + "].parent = " + p.child[i].parent); } } // Recurse for ( i = 0; i < b; i++ ) if ( p.child[i] != null ) checkSub( p.child[i] ); } }