"Eduardo F. Sandino" <ed*************@gmail.com> writes:
Thanks i will try it... I be writing from here until have a nice
HashTable implementation... optimized to solve any needs...
I doubt one thing can solve all needs. That's why it's good to have
several solutions to choose from.
I'm not sure why you need a hash table.
A hash table is a specific implementation of an associative array
(aka. dictionaray, aka. map), an updateable data structure thatm aps
key values keys into other values.
There are many ways to implement an assocative array, each with
different time/memory behavior.
A hash table creates a hash value of the keys, i.e., a number, and
uses that to index into an array - the bucket for that hash
value. Then it goes through the list of key/value pairs in that
bucket, all the ones with a key that hashes to the same value.
This gives, for a reasonable table size, an expected constant time
for insert, lookup and delete operations.
If you are just trying to implement an associative array, then it's
not necessarily a hash table that is the best choice of implementation
in Javascript. You could use the language's own implementation of
properties on objects instead, suitably wrapped. That will not
guarantee the time complexity, as different Javascript implementations
do object properties differently (some might use a hash table
internally, others might not).
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'