Prework Data Structures and Algorithms
Discussion questions…
- What is 1 of the more important things you should consider when deciding which data structure is best suited to solve a particular problem?
- One thing to consider is can this problem be solved with recursion? Pretty much a simpler dubbed down version of an otherwise lengthier function. Another thing to consider is what are you working with? Can this problem be solved with a few lines or code, or will this task be very taxing on the computer or server.
- How can we ensure that we’ll avoid an infinite recursive call stack?
- Base cases are the best way around getting stuck in infinite loops. For example a base case for a countdown would be an if else statement. If the number you want to stop at is less than or equal too the current number, stop the countdown. If not, continue counting down. A base case is pretty much a situation where a problem cannot be solved by recursion.