Analyze the worst case running time of the following code in “big-Oh” notation in terms of the variable n.
a. void fdisp1(int n) { for(int i=0; i < n; i++) { for(int j=0; j < n; j++) { for(int k=0; k < n; k++) { for(int m=0; m < n; m++) { System.out.println("Hi I am Here"); } } } } }
b. voidprintAllPossibleOrderedPairs(intarr[], int size) { for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { printf("%d = %d\n", arr[i], arr[j]); } } }
Get Answers For Free
Most questions answered within 1 hours.