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
27
votes
6 answers

JavaScript LHS and RHS Lookup

I was reading the Scopes and Closure of You don't know JS book by Kyle Simpson, specifically this topic Compiler Speak. There they mention the LHS and RHS lookup. I am failed to understand these two terms, can anyone help me to realize them?
ZIS
  • 507
  • 1
  • 6
  • 14
26
votes
7 answers

Which is faster to find an item in a hashtable or in a sorted list?

Which is faster to find an item in a hashtable or in a sorted list?
Dhanapal
  • 14,239
  • 35
  • 115
  • 142
25
votes
6 answers

Initializing Lookup

How do i declare a new lookup class for a property in the object initializer routine in c#? E.g. new Component() { ID = 1, Name = "MOBO", Category = new Lookup } The category bit always get a compile error. I have a property called…
Hannah
  • 301
  • 1
  • 4
  • 5
24
votes
1 answer

lookup function doesn't work with unsorted list

Why does this work, and looks up values correctly but once i change the order of values, it produces incorrect values?
jakub
  • 4,774
  • 4
  • 29
  • 46
24
votes
5 answers

LINQ Convert Dictionary to Lookup

I have a variable of type Dictionary> I want to convert it to a Lookup. I wanted to use Lambda functions to first, flatten the dictionary and then convert this to Lookup using the ToLookup(). I got…
Anna
23
votes
1 answer

What is the relationship between java:comp/env and java:global?

What is the relationship between java:comp/env and java:global (regarding 3.1 spec)? Seems like java:comp/env contains specific to EJB references. What means "specific" in this case?
Yamahar1sp
  • 510
  • 1
  • 6
  • 13
22
votes
6 answers

Create sine lookup table in C++

How can I rewrite the following pseudocode in C++? real array sine_table[-1000..1000] for x from -1000 to 1000 sine_table[x] := sine(pi * x / 1000) I need to create a sine_table lookup table.
user466444
  • 469
  • 3
  • 7
  • 14
21
votes
2 answers

Dictionary data structure in R

In R, I have, for example: > foo <- list(a=1,b=2,c=3) If I type foo, I get: $a [1] 1 $b [1] 2 $c [1] 3 How can I look through foo to get a list of "keys" only? In this case, (a, b, c).
user187268
21
votes
1 answer

Java HashSet equivalent in C++

I was curious if there was something akin the Java HashSet in C++? I.e. a data structure with a fast look, as I will only be running .contains(e) on it. Likewise, if you could enlighten me on how to do a .contains() on whatever data structure you…
user1352683
  • 397
  • 1
  • 3
  • 14
19
votes
1 answer

What is the best way to create a whois lookup?

I want add a domain registration in a website written with PHP. So I need a whois lookup service. What do I need to do? What's are its steps? Do I need a database, API or ... ? Help me please
Mohammad Saberi
  • 12,864
  • 27
  • 75
  • 127
19
votes
2 answers

C# System.Linq.Lookup Class Removing and Adding values

I'm using Lookup class in C# as my prime data container for the user to select values from two Checked List boxes. The Lookup class is far easier to use than using the class Dictionary>, however I cannot find methods for removing and adding values…
Ahmad Hajou
  • 1,289
  • 5
  • 22
  • 39
19
votes
7 answers

In R, What is the difference between df["x"] and df$x

Where can I find information on the differences between calling on a column within a data.frame via: df <- data.frame(x=1:20,y=letters[1:20],z=20:1) df$x df["x"] They both return the "same" results, but not necessarily in the same format. Another…
Brandon Bertelsen
  • 43,807
  • 34
  • 160
  • 255
19
votes
3 answers

Why is Lookup immutable in C#?

Unlike Dictionary, you cannot construct a Lookup by adding elements one by one. Do you happen to know the reason? Lookup is just like multimap in C++; why can't we modify it in C#? If we really can't, how can we construct a multimap data structure…
hong pei
  • 929
  • 2
  • 13
  • 27
18
votes
1 answer

How to convert string to objectId in LocalField for $lookup Mongodb

I want to add join collections using $lookup in mongodb. I am trying as below { $lookup:{ from:"User", localField:"assignedId", foreignField:"_id", as:"dataa"} } Now I have two collections User contains objectid of users like "_id"…
Saurabh Sharma
  • 804
  • 6
  • 16
  • 42
18
votes
1 answer

How to check if an element exists in a Python array (Equivalent of PHP in_array)?

I'm new to Python and I'm looking for a standard function that would tell me if an element is present in an array. I found the index method but it throws an exception if the element is not found. I just need some simple function that would return…
laurent
  • 88,262
  • 77
  • 290
  • 428