Home / MCQ Bank / Computer
Computer Miscellaneous On Data Structures

Which data structure would you use for an application that needs to handle elements with a frequent change in priority?

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • Priority Queue

Related Computer Questions

What is the output of the following code? #include<stdio.h> int find_max(int a, int b) { if(a > b) return a; return b; } int knapsack(int W, int *wt, int *val,int n) { int ans[n + 1][W + 1]; int itm,w; for(itm = 0; itm <= n; itm++) ans[itm][0] = 0; for(w = 0;w <= W; w++) ans[0][w] = 0; for(itm = 1; itm <= n; itm++) { for(w = 1; w <= W; w++) { if(wt[itm - 1] <= w) ans[itm][w] = find_max(ans[itm - 1][w-wt[itm - 1]]+val[itm - 1], ans[itm - 1][w]); else ans[itm][w] = ans[itm - 1][w]; } } return ans[n][W]; } int main() { int w[] = {10,20,30}, v[] = {60, 100, 120}, W = 50; int ans = knapsack(W, w, v, 3); printf("%d",ans); return 0; } For the incomplete C# program below, which of the C# code fragment will not result in an infinite loop? static void Main(string[] args) { int i = 1234 ,j = 0; /*ADD CODE HERE */ Console.WriteLine(j); } What is an abstract class in C++? Which of the following(s) can be used to access the first element of a vector v? What is the special database that always exists after setting up MySQL on a computer?