Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this problem, please analyze the runtime of s.intersection(t) that takes two sets, s and t, and returns a new set with all the elements
For this problem, please analyze the runtime of s.intersection(t) that takes two sets, s and t, and returns a new set with all the elements that occur in both s and t.
For part B, I'm confused as to if it is stating to find the intersection of two sets with a length of up to 10^5. Is that realistically possible, or is there a misunderstanding? How would one do this, and what would the run time chart look like? What would the asymptotic running time look like, and why? Please provide a snippet of the code used.
b) (10 points) Determine experimentally the running time of s. intersection(t), by running it with different sized sets. Fill in the following chart. Include in your PDF submission a snippet of code that determines one of the entries in the chart. Note: there are a number of ways to time code. For example, you can use the timeit module (see https://docs.python.org/3/library/timeit.html for documentation on how to use it). (c) (5 points) Give an approximate formula for asymptotic running time of s.intersection(t) based on your experiments. How does this compare with your conjecture in part (a)? If the results differ from your conjecture, make a new conjecture about the algorithm usedStep 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