Question: Part I: Algorithm Analysis 1 . You are given two linked lists with O ( n ) elements. You are asked to find the intersection
Part I: Algorithm Analysis
You are given two linked lists with On elements. You are asked to find the intersection of two lists. Assume that the sets dont have duplicates and not sorted, and also assume that comparison operation is a simple statement and it takes O time.
a Please provide a pseudo code that has the growth rate of On
b Improve your solution, and give a pseudo code that has a better growth rate which is Onlogn
c Is it possible to make it On Please provide a pseudo code for your solution, if any.
Note: You can call other functions use other data structures, you dont need to give pseudocodes for those functions. Just know their run time complexity.
You are given the following pseudocode for an algorithm:
methodn
if n
return
else
return methodn nn
methodm k
if m
return methodk
else
return methodm k
a What would be the output for the following method call?
System.out.printlnmethod;
b Please provide the recurrence form for the running time function of this algorithm.
c Please find the growth rate of the algorithm in BigO notation.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
