• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

What is Hashtable?

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,296
A hashtable is WC3's support for a type of data structure that supports any arbitary value or values as indexes to store data to.

This is like the dictonary structure in pythong but think of it as a nested dictionary.

The mechanics are that of a series of nested arrays using algerthims to get indexes which is useful due to its large range and due to its near O(1) speed compaired to simlar methods.
I would imagine they use 4 array like levels. Array level 1 is the general hashmap with efficency of O(1) for the parent key. This links to a linked list with O(n) where n is the number of hash collisions (mostly 1 unless highly populated) efficency which then links to a child hashmap. The child hashmap is the same as the parent but leading to the value and such at the end. This might not be the exact way it is done as they might use 2 hashtables were the parent one returns an additional value which combined with the child hash is used in the child hashtable.

As for you, you prety much use them as 2D arrays. Remember to flush values that are not needed to keep speed and efficency at reasonable levels.
 
Status
Not open for further replies.
Top