Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [dictionaries]

The tag has no usage guidance.

1
vote
0answers
29 views

Why is sparsity useful in dictionary learning?

What is the particular reason for which we use sparse matrix X in dictionary learning equation Y=DX where Y is the signal matrix, D is dictionary and X is the coefficient matrix?
1
vote
0answers
19 views

If statement not capturing the conditional I'm seeking [closed]

I'm working on a hw assignment, and my if statement isn't working the way it's intended. This is an ATM machine project. I've already gotten the program to read the csv file and stored it into a ...
0
votes
1answer
29 views

Parallel Algorithm for Data Averaging

I am trying to write an efficient Parallelised algorithm for Data Averaging. By this I mean I have a list of tuples (K, V1, V2, V3) and in the end, I want a dictionary mapping K to the average of all ...
2
votes
1answer
70 views

Remove duplicates from dictionary in a safe and clever way

I have a dictionary that has keys and multiple values per key. Same value can be assigned to multiple keys. For the sake of simplicity, the keys are ints and the ...
5
votes
1answer
126 views

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$ ...
1
vote
1answer
62 views

Determining possible data structures given a set of required operations

This was an interview question that I was told is supposed to be an open ended discussion of the trade-offs. You have a collection of comparable objects and want to be able to do the following: 1. ...
0
votes
1answer
253 views

How to read off the set represented by a van-Emde-Boas tree?

I'm reviewing my background in Algorithms and DS design. Specifically I never went through the van Emde Boas Tree. Though I can undestand the proto-vEB with related picture. I'm struggling to ...
0
votes
0answers
51 views

Dictionary matching problem: dictionary size estimation

Suppose we solve dictionary matching problem for $d$ patterns with the Aho-Corasick algorithm. Then our main data structure consists of a trie with $n$ vertices and auxiliary structures. I want to ...
2
votes
3answers
608 views

time efficient key value store for fast lookup

Let's state a collection of key/values. Key is an unsigned integer (0 - 2^32-1). Hense there are comparable. Value is few bytes fixed size. There are 4M items in the collection. Keys are not evenly ...
3
votes
1answer
317 views

Algorithms to correct misspelled word?

At present, I am doing a project on Optical Character Recognition (OCR). I am looking forward to improve the results by checking the output words of my OCR code with existing words from a text file. ...
0
votes
3answers
302 views

Match dictionary to misspelled word, corner cases

I'm trying to think of corner-cases where I can skip having to linear-search through my dictionary in my problem; For a given word w1, find all matches with the least editing distance from it in the ...
14
votes
3answers
1k views

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 ...
6
votes
1answer
296 views

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 ...
0
votes
1answer
222 views

What happens internally when you remove an object from a treemap

I am wondering what happens if you remove an object in the middle of a treemap. If the treemap would look something like this: So what would happen if you remove the number 30? Because 27 and 34 ...
4
votes
2answers
229 views

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 ...
0
votes
1answer
286 views

Complexity of testing membership in a disjoint set

I have a disjoint set data structure (sometimes known as a union-find data structure) where I store a value in each "node". I want to look up a node by value. How can I do this? The representations ...
6
votes
1answer
677 views

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 ...
3
votes
3answers
140 views

Data structure choice for a query-update-delete problem

Given is an initial set of n keys. Each key k is of the form (p, q). Note that both p and q are positive. At any given point, there are two possible actions: 1) Query-Delete: Given a value s as ...
1
vote
1answer
132 views

Which in-memory data structure can accommodate billions of md5 value?

For my application, I have to store billions of md5 values, and before storing new md5 I wanna make sure that it doesn't exist already in it. I tried using hash data structure, it worked well but no ...
2
votes
2answers
651 views

O(1) access into an array-like data structure with numerical ranges for keys

Preface: It's been a long time since I've been in school, and my terminology is probably all wrong. Apologies... Summary: I have a data structure with probability ranges assigned to the elements, and ...
1
vote
2answers
3k views

Data structure with constant time operations

I need to use a data structure, implementable in C++, that can do basic operations, such as lookup, insertion and deletion, in constant time. I, however, also need to be able to find the maximum value ...
2
votes
1answer
102 views

How can a set offer better search performance than an array

While reading the following tutorial on iOS development Working with Foundation (section on Sets near the bottom), I came across the following statement: "Because sets don’t maintain order, they offer ...
5
votes
3answers
11k views

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) ...
6
votes
1answer
191 views

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 ...
1
vote
1answer
472 views

A many-to-many mapping data structure

What would be a good way representing: i. Given a key, return all the data values associated with that key AND ii. Given a data value, return all the keys that are associated with that data. So far, ...
4
votes
1answer
3k views

Segment trees with insertion/deletion

I have a range query problem to solve. This problem requires not only range queries and update, but also insert or delete an element of the array. There is a series of operations that must be done in ...
2
votes
0answers
96 views

Why can't fractional cascading be used on two unrelated arrays?

According to both Wikipedia and my professor (see question 5.1), fractional cascading has to be done on arrays with related data. The specific question: A fellow student wants to compactly store ...
45
votes
4answers
10k views

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 ...
1
vote
1answer
528 views

Applications of queues [closed]

Let suppose a simple (FIFO) queue, where elements enter at a side and exit at the other side. I know the classical use of queues in everyday life and computer networking. I would like to know more ...
2
votes
3answers
43 views

Existence of functions that only tests memberships without revealing any information about the members

Given a set of strings $\{s_1, s_2, \cdots, s_n\}$, is there a way to encode them to a program $P$, such that given some string,$s$, the program can test the membership efficiently (deterministically ...
-2
votes
1answer
353 views

Find K-th next element in O(log n) time

We want to store a set S of distinct positive integers and support the following operations on S: Insert(a): insert integer a !∈ S into S. Delete(a): delete integer a ∈ S from S. ...
0
votes
1answer
1k views

Selection problem on the union of two ordered dictionaries

Suppose we are given two ordered dictionaries S and T each with n items, and that S and T are implemented by means of array-based ordered sequences. Describe an O(log n) time algorithm for finding the ...
1
vote
1answer
397 views

Data structure for range-value-sum

I have to be able to perform insert, delete, range-value-sum, and range-2-max-values with a data structure. Range-value-sum(xl,xr): with a range [xl,xr] (for a range query), it reports the sum of ...
3
votes
2answers
708 views

Data structure to insert, update and sort indexes by frequency and query an index for a particular cumulative frequency

Here is the description of the data structure I am looking for: Initial Original Data Index | Frequency | 1 3 2 1 3 7 4 2 5 6 Now it should be kept ...
1
vote
1answer
928 views

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?
3
votes
2answers
343 views

Term for binary search tree using hashes?

I was looking for a way to easily store and access a symbol table using the least memory and code as possible and I went with a BST. Symbols, however, tend to be defined in order as in foo0, foo1, ...
9
votes
2answers
758 views

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 ...
2
votes
2answers
2k views

Tree data structure for fast merges [closed]

I need trees that have the following properties: Each node in the tree has two values associated with it - a key and an associated opaque data element. An internal node in the tree has unbounded ...
2
votes
1answer
158 views

Bloom filter variant

I've been playing around with a simple probabilistic data structure which is very similar to a Bloom filter. Where a Bloom filter would use $k$ independent hash functions to choose $k$ of the $m$ bits ...
24
votes
5answers
2k views

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 ...
3
votes
2answers
304 views

Why should leaf nodes in a red-black tree be black?

From the property of Red-Black Trees we know that: All leaves (NIL) are black. (All leaves are same color as the root.)(Comren et al "Introduction to Algorithms") But what is the reason that we ...
2
votes
1answer
976 views

What is a suitable data structure in this scenario?

I need an efficient data structure for maintaining a set of values. Here, $n_1$ is the number of insertions per unit time; $n_2$ is the number of deletions per unit time; $k$ is the number of searches ...
8
votes
2answers
1k views

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 ...
6
votes
1answer
1k views

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 ...
2
votes
2answers
1k views

Data structure for maintaining large space-efficient filtered array

How does one implement a space efficient data structure that satisfies the requirements below? You have a large array You have a filter which tells you which elements in that large array are to be ...
4
votes
3answers
380 views

Why do Bloom filters work?

Let's say I am using Bloom filters to create a function to check if a word exists in a document or not. If I pick a hash function to fill out a bit bucket for all words in my document. Then if for a ...
7
votes
2answers
949 views

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 ...
8
votes
7answers
36k views

Are degree and order the same thing when referring to a B-Tree

I know the term order of a B-tree. Recently I heard a new term: B tree with minimum degree of 2. We know that the degree is related to a node but what is the degree of a tree? Does degree impose ...
17
votes
5answers
2k views

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 ...