Your colleague is working on two algorithms, they are seeking your advice.

Your colleague is working on two algorithms, \(X\) and \(Y\), that determine whether two people are a certain distance apart. They use a number of different inputs, \(n\). They are seeking your advice.

  1. If they tell you that algorithm \(X\) has a worst-case runtime complexity of \(O(n^2)\) and algorithm \(Y\) has a worst-case runtime complexity of \(O(n^3)\), which algorithm would you recommend and why?
  2. Your colleague then adds that the average-case time complexity for \(X\) is \(Θ(n^2)\) and for \(Y\) is \(Θ(n)\). Does this change your advice at all, and why? Your answers should be no longer than a sentence or two.

Solved
Dynamic Programming 1 Answer Anonymous(s) Post