r/ProgrammerHumor • • 2d ago

Meme dynamicProgramming

Post image
5.3k Upvotes

140 comments sorted by

View all comments

3

u/SignoreBanana 1d ago

Yeeeeup.

A while back I realized the solution to like 90% of DSA problems is insert sorting, bisecting, mapping, reducing, or some combination thereof.

3

u/Winterkirschenmann 1d ago

HashMap! I don't know what the problem is but the answer is a HashMap.

1

u/guyblade 14h ago

Well, the problem is that I have a bunch of timeseries data and I need to find the first data point before a specific moment in time. Are you sure that I need a HashMap?

1

u/Ziiiiik 11h ago

What would you use? A binary tree?

1

u/guyblade 1h ago

Sure. That's the underlying structure in both C++'s std::map and Java's TreeMap. They're super useful for dealing with timeseries data--especially when you have data coming from sources that may not give you the data already ordered for you or when you need to combine data from a bunch of sources.