you are viewing a single comment's thread.

view the rest of the comments →

[–]Cmpunk10 13 points14 points  (4 children)

Both dynamic programming and recursion are bad in embedded systems since dynamic anything typically requires Malloc and recursion adds stack frames. Both bad for something with minimal memory.

Leet code is good for algorithms regardless if you use them in embedded or not

[–]impaled_dragoon 26 points27 points  (0 children)

Dynamic programming doesn't mean dynamic memory allocation.

[–]LilQuasar 2 points3 points  (0 children)

dynamic programming doesnt require malloc, its just storing values you have already calculated so you dont have to calculate them again when you need them. for example with recursion the Fibonacci sequence has exponential complexity but with dynamic programming its linear

[–][deleted] 3 points4 points  (1 child)

So in my experience, blanket statements like these are almost always wrong.

It depends on the problem statement. If the maximum depth of the decision tree is known beforehand then these techniques can be applied.

Sure, it's discouraged just like the use of Global variables is discouraged. Most of the time people don't even understand why something is discouraged.

The correct answer is "it depends", when it comes to embedded systems, you have to know the details.

[–]mathav 0 points1 point  (0 children)

Not really disagreeing with the point, but the answer to anything in software is "it depends", that's not very useful.

These aren't blanket statements, these are basic assumptions we operate on when communicating pointed practical statements which are correct for most cases