×
Get Full Access to Discrete Mathematics And Its Applications - 7 Edition - Chapter 3.se - Problem 9e
Get Full Access to Discrete Mathematics And Its Applications - 7 Edition - Chapter 3.se - Problem 9e

×

# Devise an algorithm that finds all equal pairs of sums of

ISBN: 9780073383095 37

## Solution for problem 9E 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

4 5 1 337 Reviews
26
2
Problem 9E

Devise an algorithm that finds all equal pairs of sums of two terms of a sequence of n numbers, and determine the worst-case complexity of your algorithm.

Step-by-Step Solution:

SolutionStep 1In this problem, we have to finds all equal pairs of a sum of two terms in a list of an n element.AlgorithmsFind_pair(num1, num2, num3, ………… set of integer, given_sum)Now start the loop conditionfor( index_1 = 0 ; index_1 < size of element(size) ; index_1++) for (index_2 = index + 1 ; index2 < size of element(size) ; index_2++) for (index_ 3 = 0 ; index_3 < size of element(size) ; index_3++) for(index_4 = index_3 + 1 ; index_4 < size of element(size) ; index_3++) if(element at index_1 position + element at index_2 position = = element at index_3 position + element at index_4 position) then Print “(element at index_1 position , element at index_2 position)” Print “(element at index_3 position , element at index_4 position)” End of the loop.Hence, it will print all the pair of the number which equals to the sum of two terms.

Step 2 of 3

Step 3 of 3

## Discover and learn what students are asking

Calculus: Early Transcendental Functions : Iterated Integrals and Area in the Plane
?In Exercises 1 - 10, evaluate the integral. $$\int_{0}^{\cos y} y d x$$

#### Related chapters

Unlock Textbook Solution