   Chapter 11.3, Problem 9ES ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193

#### Solutions

Chapter
Section ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193
Textbook Problem
1 views

# For each of the algorithm segments in 6—19, assume that n is a positive integer. (a) Compute the actual number of elementary operations (additions, subtractions, multiplications, divisions, and comparisons) that are performed when the algorithm segment is executed. For simplicity, however, count only comparisons that occur within if then statements; ignore those implied by for-next loops. (b) Use the theorem on polynomial orders to find an order for the algorithm segment.9. s : = 0 for i : = 1 to nfor j : = 1 to 2n s : = s + i ⋅ j next jnext i

To determine

(a)

The computation of actual number of elementary operations performed.

Explanation

Given information:

The given algorithm segment is,

s := 0

for I := 1 to n

for j := 1 to 2n

s := s + i. j

next j

next I

Calculation:

Theorem on polynomial orders:

Let a0,a1,a2,.....an be real numbers and let an0

1. anxn+an1xn1+......+a1x+a0 is O(xs) for all integers sn
2. anxn+an1xn1+......+a1x+a0 is Ω(xr) for all integers rn
3. anxn+an1xn1+
To determine

(b)

To find:

An order for the given algorithm segment.

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started 