N
- the type of the nodes of the Triepublic class IntTrie<N extends IntTrie.Node<N>> extends Object
It can be used directly as a (simple) set.
Modifier and Type | Class and Description |
---|---|
static class |
IntTrie.Node<E>
class of nodes of the Trie.
|
static class |
IntTrie.SimpleNode
The most simple node possible
|
Constructor and Description |
---|
IntTrie(N root)
initializes the Trie with a root node
|
Modifier and Type | Method and Description |
---|---|
N |
add(int i)
add i to the Trie
|
void |
clear()
empty the Trie, removing all elements from it
|
boolean |
contains(int i)
does the Trie contains i ?
|
N |
getNode(int i)
get the node associated with i, or maybe the node that would be
associated with i if i was in the Trie (*optional* feature)
|
N |
getRoot() |
boolean |
isEmpty() |
boolean |
remove(int i)
remove the int i.
|
int |
size() |
Set<Integer> |
values() |
public IntTrie(N root)
root
- the root node.public final N add(int i)
i
- the int to add to the Triepublic final boolean contains(int i)
i
- the intpublic final N getNode(int i)
i
- the intpublic final N getRoot()
public final boolean remove(int i)
i
- the int to remove from the Triepublic final void clear()
public final boolean isEmpty()
public final int size()
Copyright © 2022. All rights reserved.