Logo

Algorithms Questions Set 10:

Quiz Mode

What is the competitive analysis of the FIFO (First-In-First-Out) page replacement algorithm?

1
2
3
4

Solution:

What is another name for the quick sort algorithm?

1
2
3
4

Solution:

What is an advantage of recursive insertion sort over its iterative version?

1
2
3
4

Solution:

A binary tree where every node has either zero or two children is called

1
2
3
4

Solution:

What is the time complexity of deleting an element from the rear end of a deque implemented using a singly linked list?

1
2
3
4

Solution:

Consider the following recurrence relation.

Which one of the following options is correct?

1
2
3
4

Solution:

For the following program, what is the Big O analysis of the running time (in terms of x)?

For (k=0; k< x*x; k++)

A[k] = k;

1
2
3
4

Solution:

What does the following C expression do?

x = x & (x-1)

1
2
3
4

Solution:

The eight elements A, B, C, D, E, F, G, and H are pushed onto a stack in reverse order, i.e., starting from H. The stack is then popped four times, and each element is inserted into a queue. Three elements are then deleted from the queue and pushed back onto the stack. Finally, one element is popped from the stack. What is the popped item?

1
2
3
4

Solution:

What is the output of the following recursive function that searches for a value in an array?

void my_recursive_function(int *arr, int v, int i, int l)
{
   if(i == l)
   {
        printf("-1");
        return ;
   }
   if(arr[i] == v)
   {
        printf("%d",i);
        return;
   }
   my_recursive_function(arr,v,i+1,l);
}
int main()
{
    int array[10] = {9, 6, 4, 3, 2, 1, 9, 5, 0, 8};
    int value = 2;
    int l = 10;
    my_recursive_function(array, value, 0, l);
    return 0;
}

1
2
3
4

Solution: