×
Log in to StudySoup
Get Full Access to Discrete Mathematics And Its Applications - 7 Edition - Chapter 3.se - Problem 9e
Join StudySoup for FREE
Get Full Access to Discrete Mathematics And Its Applications - 7 Edition - Chapter 3.se - Problem 9e

Already have an account? Login here
×
Reset your password

# 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 324 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

##### ISBN: 9780073383095

Unlock Textbook Solution

Enter your email below to unlock your verified solution to:

Devise an algorithm that finds all equal pairs of sums of