Question: What is the time complexity of the given code in terms of n? Briefly explain. # assume L is an NxN ( square ) 2d
What is the time complexity of the given code in terms of n? Briefly explain. # assume L is an NxN ( square ) 2d list # assume selectionSort, merge Sort, and binarySearch are implemented and just called in the code. N - len (L) #takes 0(1) time. The length of the list is n. M- - U) for A in : mergeSort (A) #Merge sott takes nlogn time to sort a list of size n for val in A: M.append (val) selectionSort (M) #Selection sort takes 2 time to sort a list of size n return binary Search (M, 42)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
