×
Log in to StudySoup
Get Full Access to Math - Textbook Survival Guide
Join StudySoup for FREE
Get Full Access to Math - Textbook Survival Guide

a) Describe an algorithm for locating the last occurrence

Discrete Mathematics and Its Applications | 7th Edition | ISBN: 9780073383095 | Authors: Kenneth Rosen ISBN: 9780073383095 37

Solution for problem 1E Chapter 3.SE

Discrete Mathematics and Its Applications | 7th Edition

  • Textbook Solutions
  • 2901 Step-by-step solutions solved by professors and subject experts
  • Get 24/7 help from StudySoup virtual teaching assistants
Discrete Mathematics and Its Applications | 7th Edition | ISBN: 9780073383095 | Authors: Kenneth Rosen

Discrete Mathematics and Its Applications | 7th Edition

4 5 1 253 Reviews
19
5
Problem 1E

a) Describe an algorithm for locating the last occurrence of the largest number in a list of integers.________________b) Estimate the number of comparisons used.

Step-by-Step Solution:

SOLUTIONStep 1In this problem, we are asked to determine the following.Step 2a).an algorithm for locating the last occurrence of the largest number in a list of integers. Let be the list of n integers.we have to find the last occurrence of the largest integer. We can do this by assigning a variable max and a variable pos for the largest number and its position respectively.We assign max to be the largest integer in the first step and then compare it with the next integer in the given set and if it is found that the new integer is larger than max, then assign that new value as max. In this method, we compare all the integers in the set and the maximum value is found out.

Step 3 of 3

Chapter 3.SE, Problem 1E is Solved
Textbook: Discrete Mathematics and Its Applications
Edition: 7
Author: Kenneth Rosen
ISBN: 9780073383095

Unlock Textbook Solution

Enter your email below to unlock your verified solution to:

a) Describe an algorithm for locating the last occurrence

×
Log in to StudySoup
Get Full Access to Math - Textbook Survival Guide
Join StudySoup for FREE
Get Full Access to Math - Textbook Survival Guide
×
Reset your password