Questions tagged [dictionaries]

52 questions
64
votes
4 answers

Why are Red-Black trees so popular?

It seems that everywhere I look, data structures are being implemented using red-black trees (std::set in C++, SortedDictionary in C#, etc.) Having just covered (a,b), red-black & AVL trees in my algorithms class, here's what I got out (also from…
34
votes
5 answers

Is there an anti-Bloom filter?

A Bloom filter makes it possible to efficiently keep track of whether various values have already been encountered during processing. When there are many data items then a Bloom filter can result in a significant memory saving over a hash table. …
20
votes
5 answers

For what kind of data are hash table operations O(1)?

From the answers to (When) is hash table lookup O(1)?, I gather that hash tables have $O(1)$ worst-case behavior, at least amortized, when the data satisfies certain statistical conditions, and there are techniques to help make these conditions…
14
votes
3 answers

Memoization without array

In Cormen et al.'s Introduction to algorithms, section 15.3 Elements of dynamic programming explains memoization as follow: A memoized recursive algorithm maintains an entry in a table for the solution to each subproblem. Each table entry initially…
14
votes
4 answers

Deleting in Bloom Filters

I know that standard Bloom Filters only have operations like inserting elements and checking if an element belongs to filter, but are also some modification of Bloom filters which enable a delete operation--for example: counting Bloom filters. I…
9
votes
2 answers

Looking for a set implementation with small memory footprint

I am looking for implementation of the set data type. That is, we have to maintain a dynamic subset $S$ (of size $n$) from the universe $U = \{0, 1, 2, 3, \dots , u – 1\}$ of size $u$ with operations insert(x) (add an element x to $S$) and find(x)…
HEKTO
  • 3,173
  • 16
  • 19
8
votes
2 answers

How are hash tables O(1) taking into account hashing speed?

Hash tables are said to be amortized $\Theta(1)$ using say simple chaining and doubling at a certain capacity. However, this assumes the lengths of the elements are constant. Computing the hash of an element requires going through the element,…
ithisa
  • 367
  • 2
  • 9
7
votes
1 answer

Most space-efficient lossy dictionary?

Short version: What is the most space-efficient lossy dictionary (with given false positive and false negative rates)? Long version: A lossy dictionary is a data structure $D$ that encodes a set $S$ of $n$ key-value pairs $(k_i, v_i)$, assorted with…
7
votes
2 answers

Bloom filter and perfect hashing

A Bloom filter uses a hash function to test membership in a given set $S$, by checking if an item is present of not at the specified position. To mitigate the effect of hash collision, multiple functions are used, yielding probabilistic bound if…
6
votes
1 answer

Best data structure for a queue with random reads?

Well, it's not exactly a queue if it allows for random reads. This question is about a data structure which behaves like a queue for insertions and a sorted dictionary for reads. Imagine an algorithm that maintains a list of elements so that: It…
Greg
  • 259
  • 1
  • 5
6
votes
3 answers

What is the advantage of seperate chaining over open addressing?

Hash tables resolve collisions through two mechanisms, separate chaining or open hashing and open addressing or closed hashing. Though the first method uses lists (or other fancier data structure) in hash table to maintain more than one entry…
ryanafrish7
  • 171
  • 1
  • 1
  • 4
6
votes
1 answer

Is it possible to implement a dictionary with efficient access according to insertion order?

I am trying to build a generic data structure that needs to hold keys and values and in the same time keep track on the indices in which keys and values were put in, like arraylists do but in a complexity of $O(\log n)$ or less. I tried to work…
Tom
  • 161
  • 3
5
votes
1 answer

Suggest a data-structure that supports the following operations with time complexity of $ O(log(n)) $

Iv'e been struggling a lot with this one. I am looking for a data-structure (could be a modification of an existing type of data-structure, or a combination of more than one data-structure), which supports the following methods, all with time…
superuser123
  • 155
  • 5
4
votes
2 answers

Fastest static associative map

Let's say that I wanted to build a key to value associative map where the only requirement was that lookup times were fast. Once built, the associative map would not allow inserts, deletes, or modifications, so is a static data structure. What would…
Alan Wolfe
  • 1,358
  • 11
  • 22
4
votes
2 answers

Are dictionaries and associative arrays the same thing?

With respect to abstract datatypes (ADTs), are the terms "dictionary" and "associative array" perfect synonyms or are there slight differences between them?
1
2 3 4