Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Are ordered hashes useful?




On 02/15/2011 07:22 PM, Simon Cozens wrote:
On 14/02/2011 03:20, Stephen J. Turnbull wrote:
But most of the examples you give there (eg, histogram) are really
special cases of dictionary.

No, I don't think so, and this is the point. Dictionaries define a
transformation between list A and list B. If you want to be pedantic, then
formally, yes, a histogram is a case of a dictionary. But in terms of how it's
being used, there isn't a second data structure B - it's just telling you
properties about list A. What we often think of as mapping between two lists
is more often asking questions about the structure of one list.


Hmmmmm, I'm actually with Stephen on this one...

Hashes, or hashing, takes some set of inputs like a set of strings and applies a hash function h() to it so that each string is mapped to a numerical position. What you then put at that position doesn't matter... Whether it's French words or a number indicating how many times the word appears in a document -- it is still a "value".

While they are both interesting uses of hashing, I'm not quite convinced that the two situations are that different...

Even if you store a binary tree at each hash table position -- which isn't a value per se -- it would be implemented as the memory address of the root of the tree. So, I guess this too is some abstract definition of a value?

Ray




Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links