Select the correct option to test your answer:
More Computer Questions
What is a motion path?
What is the primary use of a B Tree in file systems?
What function is used to calculate the cumulative distribution function (CDF) of a distribution in R?
What is the functionality of the following piece of code? public Object delete_key() { if(count == 0) { System.out.println("Q is empty"); System.exit(0); } else { Node cur = head.getNext(); Node dup = cur.getNext(); Object e = cur.getEle(); head.setNext(dup); count--; return e; } }
What will be the output for the following code? #include <stdio.h> bool func(int arr[], int n, int sum) { bool subarr[n+1][sum+1]; for (int i = 0; i <= n; i++) subarr[i][0] = true; for (int i = 1; i <= sum; i++) subarr[0][i] = false; for (int i = 1; i <= n; i++) { for (int j = 1; j <= sum; j++) { if(j<arr[i-1]) subarr[i][j] = subarr[i-1][j]; if (j >= arr[i-1]) subarr[i][j] = subarr[i-1][j] || subarr[i - 1][j-arr[i-1]]; } } return subarr[n][sum]; } int main() { int arr[] = {3, 3, 4, 4, 7}; int sum = 5; int n = sizeof(arr)/sizeof(arr[0]); if (func(arr, n, sum) == true) printf("true"); else printf("false"); return 0; }