public class BST<Key extends Comparable<Key>,Value> extends Object
| Constructor and Description |
|---|
BST() |
| Modifier and Type | Method and Description |
|---|---|
Key |
ceiling(Key key) |
boolean |
contains(Key key)
Search BST for given key, and return associated value if found,
return null if not found
|
void |
delete(Key key) |
void |
deleteMax() |
void |
deleteMin()
Delete
|
Key |
floor(Key key) |
Value |
get(Key key) |
int |
height() |
boolean |
isEmpty() |
Iterable<Key> |
keys()
Range count and range search.
|
Iterable<Key> |
keys(Key lo,
Key hi) |
Iterable<Key> |
levelOrder() |
static void |
main(String[] args)
Test client
|
Key |
max() |
Key |
min()
Min, max, floor, and ceiling
|
void |
put(Key key,
Value val)
Insert key-value pair into BST
If key already exists, update with new value
|
int |
rank(Key key) |
Key |
select(int k)
Rank and selection
|
int |
size() |
int |
size(Key lo,
Key hi) |
public boolean isEmpty()
public int size()
public boolean contains(Key key)
public void put(Key key, Value val)
public void deleteMin()
public void deleteMax()
public void delete(Key key)
public Key min()
public Key max()
public Key select(int k)
public int rank(Key key)
public int height()
public static void main(String[] args)
Copyright © 2014. All Rights Reserved.