Time Left - 05:00 mins

BARC CS 2018 Nuclear Quiz -2(Algo)

Attempt now to get your rank among 717 students!

Question 1

T(n)= 2T(n/2) +n^n, solve using masters theorem

Question 2

Consider the following strings x and y.
x=”gradeup”
y=”gateexam”
How many longest common subsequences are possible from x and y?

Question 3

A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. The root is stored at X[1]. For a node stored at X[i], the left child, if any, is stored in X[2i] and the right child, if any, in X[2i+1]. To be able to store any binary tree on n vertices the minimum size of X should be

Question 4

What is the time complexity to construct binary search tree when inorder and postorder traversal of tree is given?

Question 5

Consider the following function “find”.
find (int n, int a[])
{
int i,j,k;
for(i=1;i<m;i++)
{
k=i;
for(j=i+1;j<=m;j++)
{
if(a[j]<a[i] ) k=j;
}
if(a[i]!=a[k])swap(a[i].a[k]);
}
}
Assume swap (x,y) function exchanges the values of x and y.For any positive integer value of n, how many minimum number of swaps are performed by the function find (n)? (Best Case)
  • 717 attempts
  • 2 upvotes
  • 13 comments
Apr 5GATE & PSU CS