Package algs33
Class XRandomizedBST<K extends Comparable<? super K>,V>
java.lang.Object
algs33.XRandomizedBST<K,V>
- All Implemented Interfaces:
Iterable<K>
public class XRandomizedBST<K extends Comparable<? super K>,V>
extends Object
implements Iterable<K>
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate class
private static class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate XRandomizedBST.Node
<K, V> ceil
(XRandomizedBST.Node<K, V> x, K key, XRandomizedBST.Node<K, V> best) boolean
check()
private boolean
private boolean
boolean
private boolean
private void
fix
(XRandomizedBST.Node<K, V> x) private V
get
(XRandomizedBST.Node<K, V> x, K key) int
height()
private int
height
(XRandomizedBST.Node<K, V> x) private boolean
isBST()
private boolean
iterator()
private XRandomizedBST.Node
<K, V> joinLR
(XRandomizedBST.Node<K, V> a, XRandomizedBST.Node<K, V> b) private boolean
static void
max()
min()
private XRandomizedBST.Node
<K, V> void
private XRandomizedBST.Node
<K, V> private XRandomizedBST.Node
<K, V> remove
(XRandomizedBST.Node<K, V> x, K key) private XRandomizedBST.Node
<K, V> rotL
(XRandomizedBST.Node<K, V> h) private XRandomizedBST.Node
<K, V> rotR
(XRandomizedBST.Node<K, V> h) select
(int k) private XRandomizedBST.Node
<K, V> select
(XRandomizedBST.Node<K, V> x, int k) int
size()
private int
size
(XRandomizedBST.Node<K, V> x) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
root
-
-
Constructor Details
-
XRandomizedBST
public XRandomizedBST()
-
-
Method Details
-
contains
-
get
-
get
-
put
-
put
-
putRoot
-
joinLR
-
remove
-
remove
-
select
-
select
-
min
-
max
-
ceil
-
ceil
private XRandomizedBST.Node<K,V> ceil(XRandomizedBST.Node<K, V> x, K key, XRandomizedBST.Node<K, V> best) -
ceil2
-
iterator
- Specified by:
iterator
in interfaceIterable<K extends Comparable<? super K>>
-
size
-
size
-
height
-
height
-
fix
-
rotR
-
rotL
-
check
-
checkCount
-
checkCount
-
isBST
-
isBST
-
less
-
eq
-
main
-