Please help. In this code you will find a number of problems for a total of 50 p
ID: 3788779 • Letter: P
Question
Please help.
In this code you will find a number of problems for a total of 50 points You will need to identify three instances of o(nA2) notation 15 points You will need to identify when it is using a List for a points is 15 will need to identify where it using a sort and the type of it points where a recursive method is broken and why it is broken 10 points Name: Date public class MidtermCodelcsIS2420 extends comparable private double lowTemp new double[10] public void weekLow(E[] t) t int week temp new int[t.length]; int the Low for (int i 0: i week temp length; i++) for Low weektemp k++) f (int k i 1; k length; if (week temp[kj .compareTo(weektemp[theLow]) 0) the Low if (the Low i) swap (weektemp, i the Low) private string cel2far(double temp) f Double celsius temp String temps tring Celsius celsius is ((Celsius 9 5.0) 32) Fahrenheit return tempstring; public int newTemps (int j temp) Link List st new Link List for (int i 0; i temp. length 1; i++) st .push(temp Cij); return st.popO; public int fixTemp (int f) int retTempo 0; for (int k 0: k f k++) ret Temp f k; return ret Temp int tempchange(int number) if (number 0) return 1; tempo hange i (number, 1); Page 1Explanation / Answer
Instance of O(n^2):
1. in method weekLow(E[] t):
two nested for loops yield O(^2) here
2. in method checktemp(int n)
3. in method adjustTemp(double t)
Linked List used point:
In method newTemps(int[] temp)
Sort point:
in method weekLow(E[] t)
It is using selection sort
Recursive Point:
in method tempChange_i(int currentNumber, int sum)
Reasion: base case will never evaluates to true