What is life? This is a question that has been asked throughout history, and one that still stumps many people today. While there is no one correct answer, there are some things that we do know about life. Here are a few things to think about when it comes to life: Life is precious. This…
When a function is called, it gets it’s own stack to store the parameters, and it’s local variables. So, an implementation of recursive function that stores a local variable and waits for the values returned from another recursive call to the function and so on would require stack to store the results. Let’s see an…
First, let’s define what a maximum subsequence sum problem is. Suppose we have an array [5, -3, 4, -7, 8, 7, 4, -1] then we would want to find a contiguous sequence that has the maximum sum. In this case, subsequence [8, 7, 4] has the maximum sum i.e. 19. It’s worth noting that if…