Original Post
What would one use Hash tables for? I see the only use is for databases? I could see them being used for character inventory in a RPG. Also what does everyone here use linked list for? Thanks
quote:
Original post by MARS_999
What would one use Hash tables for? I see the only use is for databases? I could see them being used for character inventory in a RPG.
quote:
Original post by MARS_999
Also what does everyone here use linked list for?
quote:
Original post by g00chquote:
Original post by MARS_999
What would one use Hash tables for? I see the only use is for databases? I could see them being used for character inventory in a RPG.
Right. A hash table is used to store data. It''s no different, in that respect, than a linked list, binary tree (avl, rb, etc), or a plain old array. That''s why these data structures are referred to as "containers" - they contain data.
The difference between all these containers, is generally the speed of which you can add/remove/search for items.
I suspect nearly all compilers/interpreters uses hash tables for symbol lookup - i.e. given a symbol "foo" what is its data (or, where is the data located in memory?)quote:
Original post by MARS_999
Also what does everyone here use linked list for?
I''ve been playing with a very basic Scheme-Like interpreter I''m writing. I use linked lists extensively for holding the data of the program. Why? Because of constant time insertion, and constant time deletion* - plus, all data (including your program) is nothing but a list
* constant time insertion/deletion simply means that the cost(number of operations) of deleting/adding an item is not a function of the number of items in the list.
quote:
So to add or delete an item is constant in time costs. So there is no guessing how long it takes to add or delete some item, so you can count on it taking .1ms or something? Thanks
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more