Hash Tables - help me solve the problem pls

Hash Tables - help me solve the problem pls

Author
Discussion

fido

Original Poster:

17,579 posts

268 months

Tuesday 13th March 2007
quotequote all

i need to associate a [vector of dates] with a {start date, end date, integer} ...

i've started to implement this as 3 nested maps ... am i f*d up?

in other words, i'm hoping someone has done this before usign something clever using hash functions etc. (btw my only toolkit is STL)

JonRB

77,226 posts

285 months

Tuesday 13th March 2007
quotequote all
You don't say what language you're using, but in C++ I'd create a struct that holds the {start date, end date, integer} and use an object of that type as the key in an associative container like a map.

fido

Original Poster:

17,579 posts

268 months

Tuesday 13th March 2007
quotequote all
JonRB said:
You don't say what language you're using, but in C++ I'd create a struct that holds the {start date, end date, integer} and use an object of that type as the key in an associative container like a map.

thanks, that's what everyone else has now told me! (well i tried it before but forgot to define a < and == operator ... or couldn't be ars*d to think of one) got the nested map thingy working though!

ATG

21,951 posts

285 months

Tuesday 13th March 2007
quotequote all
spam = {(start,end,int):date, ... }

JonRB

77,226 posts

285 months

Thursday 15th March 2007
quotequote all
fido said:
thanks, that's what everyone else has now told me! (well i tried it before but forgot to define a < and == operator ... or couldn't be ars*d to think of one) got the nested map thingy working though!

Sounds hideous, inefficient and difficult to maintain.

Have you no pride in your code? Guess not as you've stated you "couldn't be ars*d to" do it properly. rolleyes