Java 暴击位树

标签 java collections tree

Java 有内置的数据结构来表示暴击位树吗?或者任何可能提供此功能的可用库?如果可以以简单的简短方式实现,我也会接受简短的代码作为答案。

最佳答案

你试过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

(摘录):

/**
 * 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;
    }

关于Java 暴击位树,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1073284/

相关文章:

c - 释放堆、特殊树上的内存

java - 如何在 Java 的 Rally Rest 工具包中获取整个 TestFolders 树?

java - RXTX getPortIdentifiers() 卡住了

zabbix - 如何使用java API连接zabbix服务器

java - 如何在java小程序中使用html5本地存储?

java - 如何制作由 map 支持的集合?

java - 为什么这个共同的祖先解决方案具有更好的最坏情况性能?

java - @NotNull 什么时候会抛出异常?

java - 如果我不能在不转换为迭代器的情况下获取下一个元素,为什么 Java 有链表?

java - 使用集合时覆盖的规则