Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here are a few:</p> <ul> <li><p>Suffix tries. Useful for almost all kinds of string searching (<a href="http://en.wikipedia.org/wiki/Suffix_trie#Functionality" rel="nofollow noreferrer"><a href="http://en.wikipedia.org/wiki/Suffix_trie#Functionality" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Suffix_trie#Functionality</a></a>). See also suffix arrays; they're not quite as fast as suffix trees, but a whole lot smaller.</p></li> <li><p>Splay trees (as mentioned above). The reason they are cool is threefold:</p> <ul> <li>They are small: you only need the left and right pointers like you do in any binary tree (no node-color or size information needs to be stored)</li> <li>They are (comparatively) very easy to implement</li> <li>They offer optimal amortized complexity for a whole host of "measurement criteria" (log n lookup time being the one everybody knows). See <a href="http://en.wikipedia.org/wiki/Splay_tree#Performance_theorems" rel="nofollow noreferrer"><a href="http://en.wikipedia.org/wiki/Splay_tree#Performance_theorems" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Splay_tree#Performance_theorems</a></a></li> </ul></li> <li><p>Heap-ordered search trees: you store a bunch of (key, prio) pairs in a tree, such that it's a search tree with respect to the keys, and heap-ordered with respect to the priorities. One can show that such a tree has a unique shape (and it's not always fully packed up-and-to-the-left). With random priorities, it gives you expected O(log n) search time, IIRC.</p></li> <li><p>A niche one is adjacency lists for undirected planar graphs with O(1) neighbour queries. This is not so much a data structure as a particular way to organize an existing data structure. Here's how you do it: every planar graph has a node with degree at most 6. Pick such a node, put its neighbors in its neighbor list, remove it from the graph, and recurse until the graph is empty. When given a pair (u, v), look for u in v's neighbor list and for v in u's neighbor list. Both have size at most 6, so this is O(1).</p></li> </ul> <p>By the above algorithm, if u and v are neighbors, you won't have both u in v's list and v in u's list. If you need this, just add each node's missing neighbors to that node's neighbor list, but store how much of the neighbor list you need to look through for fast lookup.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload