Re: hash
Quoth Rainer Weikusat <rweikusat@mssgmbh.com>:
> Keith Thompson <kst-u@mib.org> writes:
> > Jürgen Exner <jurgenex@hotmail.com> writes:
> >> "George Mpouras" <nospam.gravitalsun.antispam@hotmail.com.nospam> wrote:
> >> [...]
> >>>Also hashing algorythm is much slower than binary search,
> >>
> >> hash access is typically O(1) while binary search is O(log n). Why do
> >> you think hashing is slower than binary search?
> >
> > Hashing itself is not really an algorithm; it's a data structure.
>
> Hashing is an algorithm and not a data structure: Usually, it refers
> to 'calculate a "hash value"' (relatively small integer) from some
> (significantly) larger 'input data value'. Usually, this hash value is
> then used as index into a vector of pointers to locate 'a list' on
> which some kind of data item associated with this 'input data value'
> (key) should either exist or needs to be put on.
I don't know about 'usually'. One of the more common uses of hash
algorithms is in message digests and digital signatures and such.
I think perhaps Keith meant to say 'A hash *table* is not an algorithm,
it's a data structure', which is entirely true.
Ben
|