Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // mín min og max föll:
- public Key min() {
- if (isEmpty()) throw new NoSuchElementException("calls min() with empty symbol table");
- Node n = root;
- // förum eins langt til vinstri og við getum:
- while (n.left != null) {
- n = n.left;
- }
- return n.key;
- }
- public Key max() {
- if (isEmpty()) throw new NoSuchElementException("calls max() with empty symbol table");
- Node n = root;
- // förum eins langt til hægri og við getum:
- while (n.right != null) {
- n = n.right;
- }
- return n.key;
- }
Advertisement
Add Comment
Please, Sign In to add comment