public class BST<Key extends Comparable<Key>,Val> extends Object implements Iterable<Key>
| Constructor and Description |
|---|
BST() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Key key)
Search BST for given key, and return associated value if found,
return null if not found
|
void |
delete(Key key)
Delete key and associated value.
|
Val |
get(Key key) |
Iterator<Key> |
iterator()
Iterate using an inorder traversal.
|
static void |
main(String[] args) |
void |
put(Key key,
Val value)
Insert key-value pair into BST
If key already exists, update with new value
|
int |
size() |
public int size()
public void put(Key key, Val value)
public boolean contains(Key key)
public void delete(Key key)
public Iterator<Key> iterator()
iterator in interface Iterable<Key extends Comparable<Key>>public static void main(String[] args)
Copyright © 2014. All Rights Reserved.