Question
You are given two sets S1 and S2 of integers. Specifically, |S1| = n (that is, the number of integers in S1the size of S1is
You are given two sets S1 and S2 of integers. Specifically, |S1| = n (that is, the number of integers in S1the size of S1is n) while |S2| = m. The integers in S1 and S2 have been stored in memory as shown in the figure below. In particular, the integers in S1 have been sorted in ascending order, while those in S2 have not. The starting address x of S1 and the starting address y of S2 have been stored in the CPU. So are the values of n and m. Design an algorithm to determine whether S1 S2 is emptyin other words, whether the two sets have a common integer. Your algorithm should have a cost no more than 100m log2 n.
Problem 5. You are given two sets S1 and S2 of integers. Specifically, S1=n (that is, the number of integers in S1-the size of S1-is n ) while S2=m. The integers in S1 and S2 have been stored in memory as shown in the figure below. In particular, the integers in S1 have been sorted in ascending order, while those in S2 have not. The starting address x of S1 and the starting address y of S2 have been stored in the CPU. So are the values of n and m. Design an algorithm to determine whether S1S2 is empty-in other words, whether the two sets have a common integer. Your algorithm should have a cost no more than 100mlog2nStep by Step Solution
There are 3 Steps involved in it
Step: 1
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