Will read thanks for the links Eros.
Ken, Petr,
it is programmer responsability to know the number of keys he/she needs to store.
In help file I mentioned to create a Dictionary with a number of slots about the double of the keys you need to store.
This not because the key/data is a pair system but to avoid as much as possible repeating HASH values calculation inside Dictionary.
If you read http://en.wikipedia.org/wiki/Hash_table you will see how a hash table is built.
Dictionary_Create(MaxSlots) creates an in memory structure with the indicated free hash slots.
When you add a new key, the Dictionary:
- calculates the hash value (a number between 1 and MaxSlots), let say n
- see if slot at that position n is free
- if slot is free, key/data is stored directly
- if slot is not free, a local linked list is created. This linked list will contain all the keys that produced the same hash value
As you can see, the more slots, the less the possibility to create duplicated hash values, the more the speed because to find the key it is needed just one step while finding a key that produced duplicates more steps will be needed.
I know, it is not so easy, but really, try to read http://en.wikipedia.org/wiki/Hash_table It is very interesting.
Let me know if you need other info.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Will read thanks for the links Eros.
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Eros,
thanks a lot for the info!
Bye,
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Bookmarks