Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. [10pnts] Given a set S of n integer elements write and algorithm to find whether any three elements (not necessarily distinct) add up
1. [10pnts] Given a set S of n integer elements write and algorithm to find whether any three elements (not necessarily distinct) add up to 0. A pseudo code would suffice. What is time complexity of your algorithm? (e.g.: for n=6 and S-={-2,9,-2,12,4,-15,-13}, the numbers -2,-2,4 add up to 0. Note that you cannot use a single element multiple times. Thus, -2,-2,-2,-2,-2,-2,12 is NOT correct). Answer: 2. [10 pnts] You are given two sorted list of N integers in ascending order e.g., A= {-1, 3, 4, 7,8, 12), and B={5, 9, 10, 13, 14, 15}. Give an algorithm to merge these two lists to a single list in ascending order. A pseudo code would suffice. What is time complexity of your algorithm?
Step by Step Solution
★★★★★
3.37 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
1 Algorithm to find whether any three elements add up to 0 in a set S of n integer elem...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started