educative.io

How would you store quad tree in memory?

How ill you store quad tree in memory? Most of in memory store memcahe/redis dont have tree support.How you you implement it in memory @Design_Gurus ?

Hi @rahul9,

You can represent a tree using a hash in Redis. Database doesn’t need to have a support for a given data structure store it. There are some Coding Interview questions where you need to build a Trie, for example, and it can be easily built by using a hash (or a dict if you use python).

HTH,

Regards,
Artur Baruchi
(Twitter @abaruchi)

in hash we store pointer, but here there is no concept of pointers in redis,like, it can be done,though challenging