In a Binary max heap containing n numbers, the time complexity to find the smallest element is:
In which algorithm is a boolean value returned?
Which of the following is a type of traditional cipher?
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is:
Which of the following algorithms has a time complexity of Θ(n2.81)?
Which of the following is not an algorithm to find the minimum spanning tree of a given graph?
Given 2 sorted lists of size 'x' and 'y' respectively, the number of comparisons needed in the worst case by the merge sort algorithm will be:
What is the output of the following code?
#include<stdio.h>
int recursive_sum(int n)
{
if(n == 0)
return 0;
if(n < 0)
return 0;
return n + recursive_sum(n - 1);
}
int main()
{
int n = -3;
int ans = recursive_sum(n);
printf("%d",ans);
return 0;
}
What will be the recurrence relation of the following code?
int apowb(int a, int k)
{
if (k == 0) return 1;
if (k == 1) return a;
if ((k % 3) == 0)
return apowb(a*a*a, k/2);
else
return apowb(a*a*a, k/2) * a;
}
Let G = (V, E) be a simple undirected graph, and s be a particular vertex in it called the source. For x ∈ V, let d(x) denote the shortest distance in G from s to x. A breadth first search (BFS) is performed starting at s. Let T be the resultant BFS tree. If (u, v) is an edge of G that is not in T, then which one of the following CANNOT be the value of d(u) – d(v)?