Questions tagged [lookup]

Look up is related to indexes and hash tables. It is the action of accessing fastly to an item in a large collection thanks to a index (a so-called lookup table).

In computer science, a lookup table is an array that replaces runtime computation with a simpler array indexing operation. The savings in terms of processing time can be significant, since retrieving a value from memory is often faster than undergoing an 'expensive' computation or input/output operation.

The tables may be precalculated and stored in static program storage, calculated (or "pre-fetched") as part of a program's initialization phase (memoization), or even stored in hardware in application-specific platforms. Lookup tables are also used extensively to validate input values by matching against a list of valid (or invalid) items in an array and, in some programming languages, may include pointer functions (or offsets to labels) to process the matching input.

3604 questions
18
votes
4 answers

ToLookup with multiple keys

Is there a way to require multiple keys for the .ToLookup function provided by LINQ? I will admit that this seems non-intuitive at first, and I'm expecting that there's no actual way to do this, but I'm hoping that someone knows a way. I basically…
Merwer
  • 536
  • 1
  • 7
  • 18
17
votes
7 answers

Decision between storing lookup table id's or pure data

I find this comes up a lot, and I'm not sure the best way to approach it. The question I have is how to make the decision between using foreign keys to lookup tables, or using lookup table values directly in the tables requesting it, avoiding the…
cweston
  • 11,297
  • 19
  • 82
  • 107
17
votes
1 answer

How do I convert a Dictionary to a Lookup?

I have a Dictionary that has a signature: Dictionary>. I'd like to convert it to a Lookup with a signature: Lookup. I tried: Lookup loginGroups = mapADToRole.ToLookup(ad => ad.Value, ad => ad.Key); But…
dotnetN00b
  • 5,021
  • 13
  • 62
  • 95
16
votes
3 answers

How to implement a dictionary (Trie vs HashTable and important issues)?

I've ran across several questions and articles saying that dictionary implementation in java is done best using tries. But most of them didn't address important issues, as far as I saw it. So, next is a real world task: Let's assume that I need to…
Denys S.
  • 6,358
  • 12
  • 43
  • 65
16
votes
3 answers

Replace specific values based on another dataframe

First, let's start with DataFrame 1 (DF1) : DF1 <- data.frame(c("06/19/2016", "06/20/2016", "06/21/2016", "06/22/2016", "06/23/2016", "06/19/2016", "06/20/2016", "06/21/2016", "06/22/2016", "06/23/2016"), …
Alexis
  • 271
  • 3
  • 9
15
votes
5 answers

iTunes lookup API return old data in my APP

My APP check update by comparing local version and remote version returned by iTunes lookup API. But the API still return old version after new version has released. https://itunes.apple.com/us/lookup?bundleId=com.xxx.xxxx This API return new…
Jack
  • 321
  • 2
  • 9
15
votes
2 answers

Pandas table lookup

I have a pandas lookup table which looks like this Grade Lower_Boundary Upper_Boundary 1 -110 -96 2 -96 -91 3 -91 -85 4 -85 -81 5 -81 -77 6 -77 -72 7 -72 -68 8 -68 -63 9 -63 -58 10 -58 -54 11 -54 -50 12 -50 -46 13 -46…
Zenvega
  • 1,974
  • 9
  • 28
  • 45
15
votes
5 answers

Is this slower because of two lookups instead of one?

When I want to make sure that the entry I want to use exists, I usually do this. #include struct type { int member; }; std::unordered_map map; if (map.find(key) != map.end()) map[key].member = 42; However, I think it…
danijar
  • 32,406
  • 45
  • 166
  • 297
15
votes
5 answers

Calculate (x exponent 0.19029) with low memory using lookup table?

I'm writing a C program for a PIC micro-controller which needs to do a very specific exponential function. I need to calculate the following: A = k . (1 - (p/p0)^0.19029) k and p0 are constant, so it's all pretty simple apart from finding x^0.19029…
Jeremy
  • 1,083
  • 3
  • 13
  • 25
14
votes
3 answers

Enum vs Reference table vs Lookup class

While I'm designing a MySQL database for a dating website, I have come with the doubt of how to store the referenced data. Currently the database has 33 tables and there are nearly 32 different fields who need to be referenced. We have to consider…
Puigcerber
  • 9,814
  • 6
  • 40
  • 51
14
votes
3 answers

Different behavior for qualified and unqualified name lookup for template

How should this code behave? It calls generic function ignoring my overload if I use qualified name in call_read() function; and it calls overload first and then generic version if I use unqualified name. What's the difference? Is it a bug in…
axe
  • 2,331
  • 4
  • 31
  • 53
14
votes
4 answers

How to sort a lookup?

Hi I have a lookup type that stores strings and ints. static Lookup lookup; lookup = (Lookup)list.ToLookup(i => i.IP, i => i.Number); But now I need to sort this lookup by the values (number), and get the top 10 keys with…
sprocket12
  • 5,368
  • 18
  • 64
  • 133
14
votes
4 answers

Sharepoint LookUp field on Choice field?

How to create a lookup field for the Choice field..For eg: In a list i have Choice field and i have to create an lookup column in other list pointing to this choice field ..When i select this list this column is not appearing in the…
Govind
  • 544
  • 1
  • 6
  • 23
14
votes
2 answers

Interpolating data from a look up table

read the look up table LUT = np.genfromtxt('test.out', delimiter=',', dtype=float) LUT: 12, 25, 136, 6743 13, 26, 139, 6786 14, 27, 142, 6791 15, 28, 145, 6789 Values to be read from the LUT are as follows: x1, x2, x3 = 12.5, 25.5,…
Borys
  • 1,323
  • 6
  • 16
  • 40
14
votes
1 answer

Pandas lookup, mapping one column in a dataframe to another in a different dataframe

I have two pandas dataframes: df1 and df2. df1 has columns X and Y and weeknum. df2 has columns Z, weeknum, and datetime. I want to basically keep df1 and have an extra column in it that is corresponding datetime for weeknum. I can use merge but…
wolfsatthedoor
  • 7,163
  • 18
  • 46
  • 90