Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Q26E

Page 203

Change Algorithm 3 so that the binary search procedure compares x toamat each stage of the algorithm, with the algorithm terminating if x=am. What advantage does this version of the algorithm have?

Q26E

Page 217

Give a big-O estimate for each of these functions. For the function \(g\)in your estimate \[f\left( x \right)\] is \[O\left( {g\left( x \right)} \right),\] use a simple function \(g\) of smallest order.

\[\begin{array}{l}a){\rm{ }}\left( {{n^3} + {n^2}log{\rm{ }}n} \right)\left( {log{\rm{ }}n + 1} \right){\rm{ }} + {\rm{ }}\left( {17{\rm{ }}log{\rm{ }}n + 19} \right)\left( {{n^3} + 2} \right)\\b){\rm{ }}\left( {{2^n} + {\rm{ }}{n^2}} \right)\left( {{n^3} + {\rm{ }}{3^n}} \right)\\c){\rm{ }}\left( {{n^n} + {\rm{ }}n{2^n} + {\rm{ }}{5^n}} \right)(n!{\rm{ }} + {\rm{ }}{5^n})\end{array}\]

Q26E

Page 231

Describe the worst-case time complexity, measured in terms of comparisons, of the ternary search algorithm described inExercise 28 of Section 3.1.

Q26SE

Page 233

Arrange the functions nlognloglogn<n(logn)3/2<n4/3(logn)2<n3/2<nlogn<2100n<2n2<22n<2n!andin a list so that each function is big-O of the next function. [Hint: To determine the relative size of some of these functions, take logarithms]

Q27E

Page 231

Analyze the worst-case time complexity of the algorithm you devised in Exercise 29 of Section 3.1 for locating a mode in a list of nondecreasing integers.

Q27E

Page 217

Give a big-O estimate for each of these functions. For the function \(g\)in your estimate \(f\left( x \right)\) is \(O\left( {g\left( x \right)} \right),\) use a simple function \(g\) of smallest order.

\(\begin{aligned}{l}a){\rm{ }}n{\rm{ }}log\left( {{n^2}{\rm{ }} + {\rm{ }}1} \right) + {n^2}{\rm{ }}log{\rm{ }}n{\rm{ }}\\b){\rm{ }}{\left( {n{\rm{ }}log{\rm{ }}n{\rm{ }} + {\rm{ }}1} \right)^2} + \left( {log{\rm{ }}n{\rm{ }} + {\rm{ }}1} \right)\left( {{n^2}{\rm{ }} + {\rm{ }}1} \right){\rm{ }}\\c){\rm{ }}{n^{{2^n}}} + {n^{{n^2}}}\end{aligned}\)

Q27E

Page 203

The ternary search algorithm locates an element in a list of increasing integers by successively splitting the list into three sublists of equal (or as close to equal as possible) size, and restricting the search to the appropriate piece. Specify the steps of this algorithm.

Q27SE

Page 233

Give an example of two increasing functionsf(n)andg(n)from the set of positive integers to the set of positive integers such that neitherf(n)isO(g(n))norg(n)isO(f(n)).

Q28E

Page 217

For each function in Exercise 1, determine whether that function is \(\Omega \left( x \right)\) and whether it is \(\Theta \left( x \right)\).

Q28E

Page 231

Analyze the worst-case time complexity of the algorithm you devised in Exercise 30 of Section 3.1 for locating all modes in a list of nondecreasing integers.

Access millions of textbook solutions in one place

  • Access over 3 million high quality textbook solutions
  • Access our popular flashcard, quiz, mock-exam and notes features
  • Access our smart AI features to upgrade your learning
Get Vaia Premium now
Access millions of textbook solutions in one place

Recommended explanations on Math Textbooks