Dictionaries are a very useful data structure. Here I played a bit with inheritance and boost::serialization. A base class Dictionary has been derived into an hash based Dictionary, implemented using hash_set or vector. The base class Dictionary has been also derived into a compressed Dictionary, using prefix compression and avoid strings. All the classes support serialization. Here you have the code.
PS: note that hash_set needs some special #define on my ubuntu. Otherwise it won't compile. Check the Makefile
PS: boost serialization for a polymorphic class is not a easy one. Check the code for the serialization of a derived class
Dynamic Programming | Set 30 (Dice Throw)
-
Given n dice each with m faces, numbered from 1 to m, find the number of
ways to get sum X. X is the summation of values on each face when all the
dice a...
4 minutes ago