Java中是否有內置的數據結構來表示Crit位樹?或者任何可能提供這種功能的庫?如果可以簡單簡單地實施,我也會接受簡短的代碼作爲答案。Java Crit-bit Trees
6
A
回答
5
您是否嘗試過radixtree java項目?
你可能在其中找到你要找的結構,如:
- RadixTree類
(摘錄):
/**
* This interface represent the operation of a radix tree. A radix tree,
* Patricia trie/tree, or crit bit tree is a specialized set data structure
* based on the trie that is used to store a set of strings. In contrast with a
* regular trie, the edges of a Patricia trie are labelled with sequences of
* characters rather than with single characters. These can be strings of
* characters, bit strings such as integers or IP addresses, or generally
* arbitrary sequences of objects in lexicographical order. Sometimes the names
* radix tree and crit bit tree are only applied to trees storing integers and
* Patricia trie is retained for more general inputs, but the structure works
* the same way in all cases.
*
* @author Tahseen Ur Rehman
* email: tahseen.ur.rehman {at.spam.me.not} gmail.com
*/
public interface RadixTree<T> {
/**
* Insert a new string key and its value to the tree.
*
* @param key
* The string key of the object
* @param value
* The value that need to be stored corresponding to the given
* key.
* @throws DuplicateKeyException
*/
public void insert(String key, T value) throws DuplicateKeyException;
- RadixTreeNode class
(摘錄):
/**
* Represents a node of a Radix tree {@link RadixTreeImpl}
*
* @author Tahseen Ur Rehman
* @email tahseen.ur.rehman {at.spam.me.not} gmail.com
* @param <T>
*/
class RadixTreeNode<T> {
private String key;
private List<RadixTreeNode<T>> childern;
private boolean real;
private T value;
/**
* intailize the fields with default values to avoid null reference checks
* all over the places
*/
public RadixTreeNode() {
key = "";
childern = new ArrayList<RadixTreeNode<T>>();
real = false;
}
2
另一種選擇是rkapsi的patricia-trie,或者如果你正在尋找的東西少一點複雜,你可以在自己的破解,你可以嘗試他的simple-patricia-trie。
我也有一個functional-critbit實現可用,專注於空間效率(雖然它的性能也很好)。它具有可變和不可變的風味。
0
相關問題
- 1. Ptracing Process Trees
- 2. DynamicMethods,Expression Trees和DLR
- 3. b-trees的順序
- 4. 何時使用Kd-Trees?
- 5. Git - Broken Links,Missing&Dangling Trees
- 6. Multi_dimensional R-Trees中的範圍搜索
- 7. 在C#和Expression Trees中玩對象查詢「模式」
- 8. RedBlack Trees:我想了解刪除紅黑樹中的節點?
- 9. 有沒有辦法在Graphviz上繪製B-Trees?
- 10. T-trees:爲什麼它們不用於磁盤索引?
- 11. 在B-Trees的背景下,「關鍵」究竟意味着什麼?
- 12. 它如何比較/匹配圖像與kd-trees和最近鄰居搜索?
- 13. 是否有可能在vim中有相同的視圖中的2個Nerd Trees
- 14. 可以在針對R/R */X-Trees的查詢中跳過維度嗎?
- 15. 是否有任何內置的方法來實現python 3.6中的'trees'?
- 16. JAVA:二叉樹
- 17. Java - 無法看到包中的類
- 18. 結構不同的樹java
- 19. 編譯單元訪問者 - Java編譯器樹api
- 20. 多維Arraylist Java
- 21. Java編譯器樹api:NPE
- 22. IntervalTree DeleteNode Java實現
- 23. 在java註釋處理器中發現一個methodinvocation的類
- 24. 當實現Trees/Heaps/Lists等時,爲什麼`find`方法將迭代器返回給對象而不是自己呢?
- 25. java - 程序的執行
- 26. 在Java中獲得繼承者的集合
- 27. 大數據集的廣義後綴樹Java實現
- 28. java huffman tree precedence
- 29. Java,Java VM,Java平臺,
- 30. XML解析Java Java Java
' T型鑄造(對象o)' 困擾先生。編譯器。好奇,如果你使用Eclipse構建? Eclipse的編譯器可以讓你擺脫這樣的事情。 –
alphazero
2011-12-30 17:15:19