Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Hash table

Name: Anonymous 2012-02-12 0:24

Is it ever possible to have a Hash table that can do get,put,remove @ O(1) for Strings?

calculating the hash for the String alone is O(n), is it not? [that's if you want to produce a good hash that won't collide all over the place]

Name: Anonymous 2012-03-18 14:38

>>82
Yes what is your point? It's still a function.

Listen Kodak, all a function has to do is to return a single value. If you change the definition of a function it's a different function, so for instance if you first let f(x) = 1 and then let f(x) = 2, nothing has been violated, both are still functions. In this case the function is the return value of another function which takes a set to filter against. Consider the FIOC example.

def d(filter_set):
  return lambda x : x in filter_set


Now let f = d([2, 3]), given some input f will either return True or False, so it fits the definition of a mathematical function. If you later change f = d([1, 2]), f will return different values for some input compared to the old f, but they're both still functions.

Rightfully you may mutate filter_set after the creation of f so that the same (in the Python sense) function returns different values, but that's not relevant since it's not allowed in the mathematical sense.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List