• :00Days
  • :00Hours
  • :00Mins
  • 00Seconds
A new era for learning is coming soonSign up for free
Log In Start studying!

Select your language

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

Q1E

Expert-verified
Discrete Mathematics and its Applications
Found in: Page 202
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

Short Answer

List all the steps used by algorithm 1 to find the maximum of the list

1, 8, 12, 9, 11, 2, 14, 5, 10, 4

The maximum of 1, 8, 12, 9, 11, 2, 14, 5, 10, 4 is 14.

See the step by step solution

Step by Step Solution

Step 1: Finding the maximum element in a finite sequence by algorithm:

procedure max a1,a2,......, an : integersmax : alfor i : = 2 to n if max<ai then max : = aireturn max max is the largest element

Step 2: Writing the steps used by the algorithm:

Set max = 1

Compare 1 with 8, since 1 < 8 , set max = 8

Compare 8 with 12, since 8 < 12 , set max = 12

Compare 12 with 9, since 12 < 9 , set max = 12

Compare 12 with 11, since 12 < 11 , set max = 12

Compare 12 with 2, since 12 < 2 , set max = 12

Compare 12 with 14, since 12 < 14 , set max = 14

Compare 14 with 5, since 14 < 5 , set max = 14

Compare 14 with 10, since 14 < 10 , set max = 14

Compare 14 with 4, since 14 < 4 , set max = 14

Therefore, the maximum of the given list 1, 8, 12, 9, 11, 2, 14, 5, 10, 4 is 14.

Recommended explanations on Math Textbooks

94% of StudySmarter users get better grades.

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