Chapter 1: Problem 13
Algorithm A performs \(10 n^{2}\) basic operations, and algorithm \(\mathrm{B}\) performs 300 In \(n\) basic operations. For what value of \(n\) does algorithm B start to show its better performance?
Chapter 1: Problem 13
Algorithm A performs \(10 n^{2}\) basic operations, and algorithm \(\mathrm{B}\) performs 300 In \(n\) basic operations. For what value of \(n\) does algorithm B start to show its better performance?
All the tools & learning materials you need for study success - in one app.
Get started for freeUsing the definitions of \(O\) and \(\Omega\), show that $$6 n^{2}+20 n \in O\left(n^{3}\right) \quad \text { but } \quad 6 n^{2}+20 n \notin \Omega\left(n^{3}\right)$$
Write an algorithm that finds the largest number in a list (an array) of \(n\) numbers.
Let \(p(n)=a_{k} n^{k}+a_{k-1} n^{k-1}+\ldots+a_{1} n+a_{0},\) where \(a_{k}>0 .\) Using the Properties or order in Section \(1.4 .2,\) show that \(p(n) \in \Theta\left(n^{k}\right)\)
Write an algorithm that prints out all the subsets of three elements of a set of \(n\) elements. The elements of this set are stored in a list that is the input to the algorithm.
Suppose you have a computer that requires 1 minute to solve problem instances of size \(n=1,000 .\) Suppose you buy a new computer that runs 1,000 times faster than the old one. What instance sizes can be run in 1 minute, assuming the following time complexities \(T(n)\) for our algorithm? a. \(T(n)=n\) b. \(T(n)=n^{3}\) c. \(T(n)=10^{n}\)
What do you think about this solution?
We value your feedback to improve our textbook solutions.