   Chapter 11.3, Problem 8ES ### 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.8. a : = 0 for i : = 1 to ⌊ n / 2 ⌋ a : = a + 3 next i

To determine

(a)

The computation of actual number of elementary operations performed.

Explanation

Each iteration of the loop requires one addition and there are as many iterations of the loop as there are integers from 1 to n/2, namely n21+1=n2 times.

If n is even, then n2=n2, so the number of elementary operations performed is n2

To determine

(b)

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 