It is so the keys would be ordered in the map. This is useful in a lot of cases. When you iterate through entries in std::map you are iterating in a specific order. You can define that order yourself by giving map your own custom comparator. This is actually useful in a lot of cases. With hashmap there is no order to the entries. Also there is SGI's implementation of hash_map that I believe somebody already talked about in this conversation. - Lev.
On Wed, May 26, 2010 at 2:48 AM, Ketan Joshi <ketan.s.jo...@gmail.com>wrote: > Hi guys, > > This could be a wrong forum for such a question, but I am posting it here > anyways. > > I read somewhere that c++ maps are implemented using height balanced trees > (red black trees specifically). > > Why wasn't it implemented using hash tables? wouldn't it have been faster > specially since maps dont allow duplicate keys? > > ~Ketan > > -- > You received this message because you are subscribed to the Google Groups > "google-codejam" group. > To post to this group, send email to google-c...@googlegroups.com. > To unsubscribe from this group, send email to > google-code+unsubscr...@googlegroups.com<google-code%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to google-c...@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.