Question: Prof. Justin Trudeau has designed the following recursive algorithm Justin Sort(L, n) to sort a singly-linked list L storing n numbers: Algorithm Justin Sort(L, n):

Prof. Justin Trudeau has designed the following recursive algorithm Justin Sort(L, n) to sort a singly-linked list L storing n numbers: Algorithm Justin Sort(L, n): if n=1 then return L else Let x be the last number in L; Let L' be the list obtained by deleting x from L; L' = Justin Sort(L', n 1); Insert x into L' so that the resulting list is sorted; Let L be the resulting list; return L endif What is the running time of algorithm Justin Sort(L, n)? Select one: O a. T(n) = (n) O b. T(n) = (n log n) OcT(n) = (log n) 0 d. T(n) = 9(m2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
