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.

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.