c. iii) Given the tight upper bound for the algorithm with the time upper bound functions. Use Big-O Notation for your answers?
-
For the function n2+3n+1:
The dominant term is n2.
The tight upper bound is O(n2).
-
For the function 2n+logn:
The dominant term is 2n, which simplifies to n in Big-O notation.
The tight upper bound is O(n).
-
For the function n+n3+2n:
The dominant term is 2n because exponential growth is much faster than polynomial growth (n3).
The tight upper bound is O(2n).
d) Define intractable problem with and example?
An intractable problem is a computational problem for which no algorithm can find a solution in polynomial time with respect to the input size. This means that as the input size grows, the time required to solve the problem increases exponentially or factorially, making it practically impossible to solve for large inputs within a reasonable timeframe.
Example: The Traveling Salesperson Problem (TSP) is a classic example. Given a list of cities and the distances between each pair of cities, the problem is to find the shortest possible route that visits each city exactly once and returns to the origin city. For a small number of cities, it can be solved, but for a large number of cities, the number of possible routes grows factorially, making it intractable to find the optimal solution in a practical amount of time.
What's next?