Problem Set 1 Assigned: May 27 Due: June 3 Problem 1 For each of the following pairs of functions f (n) and g(n), state whether f is o(g), f is (g);…

AllLessThan1(int[] A,B) return bool {for (i=1 to |A|)for (j=1 to |B|)if (A[i] >= B[j]) return FALSE;return TRUE;}AllLessThan2(int[] A,B) return bool {largeA = A[1]for (i = 2 to |A|)if (A[i] > largeA) largeA = A[i];for (j = 1 to |B|)if (largeA >= B[j]) return FALSE;return TRUE;}1A. Give the asymptotic worst-case running time of each algorithm as a function of |A| and |B|.When does the worst case occur?B. Give the asymptotic best-case running time of each algorithm as a function of |A| and |B|. Whendoes the best case occur?C. Design an algorithm whose best-case running time is as good as the best-case for both of thesealgorithms, and whose worst-case running time is as good as the worst-case both of these algorithms.