Question: Question-3 (15 pts: two_sum is a Python function that takes in a list of integers (elements) and an integer number (num), and returns True if

Question-3 (15 pts: two_sum is a Python function that takes in a list of integers (elements) and an integer number (num), and returns True if there exists two values in elements that add up to num, otherwise, function returns False. def two_sum (elements: List[int], num: int) for i in range (len (elements)): for j in range (i + 1): if elements[i] + elementsil um return True return False Study above function and answer below questions: A- B- What is time complexity of two surm Is it possible to improve on above algorithm performance (in terms of its asymptotic cost)? If yes, describe your algorithm, be detailed as much as possible
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
