Log In Start studying!

Select your language

Suggested languages for you:
Answers without the blur. Sign up and see all textbooks for free! Illustration

Chapter 3: Algorithms

Expert-verified
Discrete Mathematics and its Applications
Pages: 191 - 233
Discrete Mathematics and its Applications

Discrete Mathematics and its Applications

Book edition 7th
Author(s) Kenneth H. Rosen
Pages 808 pages
ISBN 9780073383095

Answers without the blur.

Just sign up for free and you're in.

Illustration

245 Questions for Chapter 3: Algorithms

  1. a) Show that this algorithm determines the number of 1 bit in the bit string S:

    Found on Page 229
  2. Show that \({x^3}\) is \(O({x^4})\) but that \({x^4}\)is not \(O({x^3})\).

    Found on Page 216
  3. 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 x−n=1/xnto compute xnwhen nis negative.]

    Found on Page 202
  4. a.) Explain the concept of a greedy algorithm.

    Found on Page 233
  5. Devise an algorithm that finds the closest pair of integers in a sequence of n integers, and determine the worst-case complexity of your algorithm. [Hint: Sort the sequence. Use the fact that sorting can be done with worst-case time complexity O(n log n).] The shaker sort (or bidirectional bubble sort) successively compares pairs of adjacent elements, exchanging them if they are out of order, and alternately passing through the list from the beginning to the end and then from the end to the beginning until no exchanges are needed.

    Found on Page 233
  6. a) Suppose we have n subsets S1,S2,...,Snof the set {1,2,.....,n}. Express a brute-force algorithm that determines whether there is a disjoint pair of these subsets. [Hint: The algorithm should loop through the subsets; for each subsetSi, it should then loop through all other subsets; and for each of these other subsets Sj, it should loop through all elements k inSi to determine whether kalso belongs to Sj].

    Found on Page 229
  7. Show that \(3{x^4} + 1\) is \(O({x^4}/2)\) and \({x^4}/2\)is not \(O(3{x^4} + 1)\).

    Found on Page 216
  8. Describe an algorithm that interchanges the values of the variables xand y, using only assignments. What is the minimum number of assignment statements needed to do this?

    Found on Page 202
  9. Define what it means for a problem to be tractable and what it means for a problem to be solvable.

    Found on Page 233
  10. Show the steps used by the shaker sort to sort the list 3, 5,1,4,6,2.

    Found on Page 233

Related Math Textbooks with Solutions

94% of StudySmarter users get better grades.

Sign up for free
94% of StudySmarter users get better grades.