• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Hashtables VS Arrays?

Status
Not open for further replies.
ok guys, here i am.
I have a big doubt, I do not know what better method to make my system, hashtables or arrays?

I'm really lost, my system has several Triggers MUI, triggers enormous only itself, they are just parts of the system. the system works with many values the same time and has many variables (that even the names confuse me), it is a system of quests and it is almost ready with array, but do not know if they are the best solution (despite being everything working).

OBS: if you need more information you can ask
OBS2: sorry my english and please use an english simpler, I live in south america.

Please help-me guys :vw_sad:
 
Systems are highly recommended for hashtables,except for Missiles.

Arrays are much faster than hashtables,but hashtables have infinite spaces than arrays.

When retrieving datas without a given integer, hashtables can handle faster,because it finds the value in O(1), which arrays do is O(n), which is slow.
I agree partially.
However, the operation complexity is exactly the same for both arrays and hashtables.
You can do a lookup and a reverse lookup for both types on O(1).

Also, you can use a Unit Indexer for O(1) lookups on unit arrays.
 
I agree partially.
However, the operation complexity is exactly the same for both arrays and hashtables.
You can do a lookup and a reverse lookup for both types on O(1).

Also, you can use a Unit Indexer for O(1) lookups on unit arrays.

I don't think so. Magtheridon stated that you can look up an array without integer (using a handle) via iterating it(returning index) while hashtables just do the easier trick.
 
I was reading a little about hashtables in a Tutorial made by jazztastic, and he speaks something about, not have more than 10 Hashtables in map. why?
the maximum is 256.

I'm redoing the system in hashtables, it creates one hashtable for each player, and i use they this way:
Value in QUEST NUMBER in HASHTABLE [Player Number].

what do yours think?
 
One hashtable is enough to handle a map. A hashtable contains 2^31 spaces,which is a lot.

So,suggestion is that don't create so many of them.

how can I deal with many values using only one Hashtables?
i can save the player numbers with key handle and save the quest number using variable integer?

EX:
1 in (Key Player Number) in Hashtable
1 in QuestIndex in Hashtable
 
I have an idea
I need two values, I do not have to work with player number, but yes with number of quest for Player, since each quest has your individual counter.

then I would one number for each player, example: Player 1 = 1000, Player 2 = 2000...

then i make like:
Set Integer = Player Number X 1000
save Value in 1 of Integer in Hashtable

this would work?
 
Status
Not open for further replies.
Top