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

Find all pairs of functions of the same order in this list of functions:n2+2n,n2+2100,n2+22n,n2+n!,n2+3n and(n2+1)2.

Short Answer

Expert verified

All pairs of functions does not have same order of O(n2)using the fact that nhas a higher order than logn.

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

Over 22 million students worldwide already upgrade their learning with Vaia!

01

Definition

Let f and g be functions from the set of integers or the set of real numbers to the set of real numbers. We say that f(x) isΘ(g(x)) iff(x) isO(g(x)) andf(x) is Ω(g(x)). Whenf(x) isΘ(g(x)) we say thatf is big-Theta of g(x), thatf(x) is order ofg(x) and thatf(x) andg(x) are of the same order.

02

 Determine the order for all pairs of functions

We know thatlognn and the Big- O estimate of the sum of terms is the Big-O terms of the highest order term

Now the order for the functions are,

n2+2nisO(2n)

role="math" localid="1668603397132" n2+2100isO(n2)

n2+22nisO(4n)

n2+n!isO(n!)

n2+3nisO(3n)

(n2+1)2is(n4)

Hence all pairs of functions does not have same order.

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Devise an algorithm to compute xn, where xis a real number and nis an integer. [Hint:First give a procedure for computing xnwhen nis nonnegative by successive multiplication by x, starting with 1. Then extend this procedure, and use the fact that xn=1/xnto compute xnwhen nis negative.]

Express the relationship fxis Ω(g(x)) using a picture. Show the graphs of the functions f (x) and Cg(x), as well as the constant k on the real axis.

a) Describe in detail (and in English) the steps of an algorithm that finds the maximum and minimum of a sequence of elements by examining pairs of successive elements, keeping track of a temporary maximum and a temporary minimum. Ifn is odd, both the temporary maximum and temporary minimum should initially equal the first term, and ifn is even, the temporary minimum and temporary maximum should be found by comparing the initial two elements. The temporary maximum and temporary minimum should be updated by comparing them with the maximum and minimum of the pair of elements being examined.

b) Express the algorithm described in part (a) in pseudocode.

c) How many comparisons of elements of the sequence are carried out by this algorithm? (Do not count comparisons used to determine whether the end of the sequence has been reached.) How does this compare to the number of comparisons used by the algorithm in Exercise 5?

Sort these lists using a selection sort

a)3,5,4,1,2 b)5,4,3,2,1 c)1,2,3,4,5.

a) 3,5,4,2,1

Use the greedy algorithm to make change using quarters, dimes, nickels, and pennies for

a) 51 cents. b) 69 cents.

c) 76 cents. d) 60 cents.

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free