Self Studies

Algorithms Test...

TIME LEFT -
  • Question 1
    2 / -0.33

    The following paradigm can be used to find the solution of the problem in minimum time:

    Given a set of non-negative integer, and a value K, determine if there is a subset of the given set with sum equal to K:

  • Question 2
    2 / -0.33

    What is the complexity of finding the 100th largest element in an already constructed binary max-heap?

    NOTE:
    Max-heap doesn't contain duplicate elements

  • Question 3
    2 / -0.33

    Let us consider that the capacity of the knapsack W = 55 and the list of provided items are shown in the following table. 

     

    1

    2

    3

    4

    5

    Profit

    100

    50

    150

    200

    130

    Weight

    25

    10

    20

    45

    15


    Find the maximum profit gain by applying fractional knapsack.

  • Question 4
    2 / -0.33

    What is the minimum number of comparisons required in an array to find the minimum and maximum of 202 integers?

  • Question 5
    2 / -0.33

    If Bubble sort is implemented to sort a collection of numbers on a singly linked list then which of the following statements are TRUE?

  • Question 6
    2 / -0.33

    Consider the following elements:

    15, 105, 37, 50, 63, 131, 8, 34, 205, 405, 5 and Hash table size = 13

    How many collisions occur when these key’s are first folded by adding their digits together and then reducing to mod hash table size.

  • Question 7
    2 / -0.33

    An array of 100 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is _________.

  • Question 8
    2 / -0.33

    The cost of minimum cost spanning tree of the following graph is:

  • Question 9
    2 / -0.33

    Which is/are complexities of their corresponding algorithms?

  • Question 10
    2 / -0.33

    What is the time complexity of the following fragment of code

    void testbook(int n ) {

    int i, j, k;

    for(i=0; i

    for(j=i; j≤n-1; j++) {

    for(k=1; k≤n; k=k*2) {

    printf(“Hello Testbook”)  }

    } } }

  • Question 11
    2 / -0.33

    The elements 42, 25, 30, 40, 22, 35, 26 are inserted one by one in the given order into a max heap. The resultant max-heap is stored in an array implementation as

  • Question 12
    2 / -0.33

    The recurrence equation T(n) = T(√n) + O(1) has the following asymptotic solution:

  • Question 13
    2 / -0.33

    In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an O(n) time algorithm. What is the worst case time complexity of the quick sort?

  • Question 14
    2 / -0.33

    Let the length of sorted arrays of X1, X2, X3, X4, and X be 70, 91, 79, 92, and 20 respectively. To merge them into a single array X by merging two arrays at a time using an optimal algorithm. In the worst case, the maximum number of comparisons needed is _____.

  • Question 15
    2 / -0.33

    Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then

  • Question 16
    2 / -0.33

    If in best case quicksort is implemented for an input of size 1024 takes 80 seconds. How much time in seconds will require to process the input of size 524288?

  • Question 17
    2 / -0.33

    What is the most efficient algorithm that searches for a value in an m x n matrix. The matrix has the following properties:

    • Integers in each row are sorted from left to right.
    • The first integer of each row is greater than the last integer of the previous row.

  • Question 18
    2 / -0.33

    Consider the following set of tasks with their associated profits and deadlines, provided that 2 tasks can be completed in a unit time if the optimal schedule is able to get a profit of 128, then maximum value of ‘x’ possible is _____ .

    Task

    Profit

    Deadline

    1

    21

    5

    2

    12

    4

    3

    9

    1

    4

    7

    4

    5

    16

    3

    6

    14

    2

    7

    8

    5

    8

    6

    ‘x’

    9

    7

    2

    10

    17

    7

    11

    17

    1

    12

    5

    2

  • Question 19
    2 / -0.33

    Consider 4 matrics A, B, C, and D of dimensions 10 × 9, 9 × 12, 12 × 10, and 10 × 15, respectively. Which of the following is/are true about the number of scalar multiplications required to find the product ABCD using the basic matrix multiplication method? 

  • Question 20
    2 / -0.33

    Consider an array A of size 63, which consists of only 1’s or 0’s in it. In array A elements are arranged in ascending order. The maximum number of probes needed to find the minimum index j of A for which A[j] = 1 using optimal algorithm is _____.

  • Question 21
    2 / -0.33

    Let P be a QuickSort Program to sort numbers in ascending order using the first element as pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {1, 2, 3, 4, 5} and {4, 1, 5, 3, 2} respectively. Which one of the following holds?

  • Question 22
    2 / -0.33

    You have an array of n elements. Suppose you implement quicksort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case performance is

  • Question 23
    2 / -0.33

    Consider the following C code segment int Ls Prime (n)

    {

    int i, n;

    for (i=2; i<= sqrt(n); i++)

    if (n % i == 0)

    {

    printf (“ Not Prime.\n”);

    return 0;

    }

    return 1;

    }

    Let T(n) denote the number of times the for loop is executed by the program on input n. Which of the following is true? 

  • Question 24
    2 / -0.33

    In a permutation a1.....an of n distinct integers, an inversion is a pair (ai, aj) such that i < j and ai > aj. What would be the worst case time complexity of the Insertion Sort algorithm, if the inputs are restricted to permutations of 1.....n with at most n inversions?

  • Question 25
    2 / -0.33

    Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst case complexity of sorting n numbers using randomized quicksort?

Submit Test
Self Studies
User
Question Analysis
  • Answered - 0

  • Unanswered - 25

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
Submit Test
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now