Design & Analysis of Algorithms

105402
Back to Design & Analysis of Algorithms

Module 2: Divide and Conquer Paradigm and Heaps

  1. Q1a. Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following is TRUE? I. Quicksort runs in \Theta(n^2) time II. Bubblesort runs in \Theta(n^2) time III. Mergesort runs in \Theta(n) time IV. Insertion sort runs in \Theta(n) time - (i) I and II only - (ii) I and III only - (iii) II and IV only - (iv) I and IV only20242m

    Module 2: Divide and Conquer Paradigm and Heaps

    Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following is TRUE?

    I. Quicksort runs in Θ(n2)\Theta(n^2) time
    II. Bubblesort runs in Θ(n2)\Theta(n^2) time
    III. Mergesort runs in Θ(n)\Theta(n) time
    IV. Insertion sort runs in Θ(n)\Theta(n) time

    • (i) I and II only
    • (ii) I and III only
    • (iii) II and IV only
    • (iv) I and IV only
    View this question on its own page →
  2. Q1b. Worst-case complexity of heap sort is - - (i) O(\log n) - (ii) O(n^2) - (iii) O(n \log n) - (iv) O(n)20242m

    Module 2: Divide and Conquer Paradigm and Heaps

    Worst-case complexity of heap sort is -

    • (i) O(logn)O(\log n)
    • (ii) O(n2)O(n^2)
    • (iii) O(nlogn)O(n \log n)
    • (iv) O(n)O(n)
    View this question on its own page →
  3. Q1c. The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are: - (i) \Theta(n \log n), \Theta(n \log n) and \Theta(n^2) - (ii) \Theta(n^2), \Theta(n^2) and \Theta(n \log n) - (iii) \Theta(n^2), \Theta(n \log n) and \Theta(n \log n) - (iv) \Theta(n^2), \Theta(n \log n) and \Theta(n^2)20242m

    Module 2: Divide and Conquer Paradigm and Heaps

    The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:

    • (i) Θ(nlogn)\Theta(n \log n), Θ(nlogn)\Theta(n \log n) and Θ(n2)\Theta(n^2)
    • (ii) Θ(n2)\Theta(n^2), Θ(n2)\Theta(n^2) and Θ(nlogn)\Theta(n \log n)
    • (iii) Θ(n2)\Theta(n^2), Θ(nlogn)\Theta(n \log n) and Θ(nlogn)\Theta(n \log n)
    • (iv) Θ(n2)\Theta(n^2), Θ(nlogn)\Theta(n \log n) and Θ(n2)\Theta(n^2)
    View this question on its own page →
  4. Q1c. The complexity algorithm of binary search is: - (i) O(n) - (ii) O(\log n) - (iii) O(n^2) - (iv) O(n \log n)20222m

    Module 2: Divide and Conquer Paradigm and Heaps

    The complexity algorithm of binary search is:

    • (i) O(n)O(n)
    • (ii) O(logn)O(\log n)
    • (iii) O(n2)O(n^2)
    • (iv) O(nlogn)O(n \log n)
    View this question on its own page →
  5. Q1d. The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is - (i) O(n) - (ii) O(\log n) - (iii) O(n \log n) - (iv) O(1)20242m

    Module 2: Divide and Conquer Paradigm and Heaps

    The minimum number of comparisons required to determine if an integer appears more than n/2n/2 times in a sorted array of nn integers is

    • (i) O(n)O(n)
    • (ii) O(logn)O(\log n)
    • (iii) O(nlogn)O(n \log n)
    • (iv) O(1)O(1)
    View this question on its own page →
  6. Q1g. In the divide and conquer process, breaking the problem into smaller sub-problems is the responsibility of: - (i) divide/break - (ii) sorting/divide - (iii) conquer/solve - (iv) merge/combine20222m

    Module 2: Divide and Conquer Paradigm and Heaps

    In the divide and conquer process, breaking the problem into smaller sub-problems is the responsibility of:

    • (i) divide/break
    • (ii) sorting/divide
    • (iii) conquer/solve
    • (iv) merge/combine
    View this question on its own page →
  7. Q1h. A priority queue is implemented as a Max-heap. Initially it has 5 elements. The level order traversal of the heap is 10, 8, 5, 3, 2. Two new elements '1' and '7' are inserted into the heap in that order. The level order traversal of the heap after the insertion of the elements is: - (i) 10, 8, 7, 5, 3, 2, 1 - (ii) 10, 8, 7, 2, 3, 1, 5 - (iii) 10, 8, 7, 1, 2, 3, 5 - (iv) 10, 8, 7, 3, 2, 1, 520222m

    Module 2: Divide and Conquer Paradigm and Heaps

    A priority queue is implemented as a Max-heap. Initially it has 5 elements. The level order traversal of the heap is 10, 8, 5, 3, 2. Two new elements '1' and '7' are inserted into the heap in that order. The level order traversal of the heap after the insertion of the elements is:

    • (i) 10, 8, 7, 5, 3, 2, 1
    • (ii) 10, 8, 7, 2, 3, 1, 5
    • (iii) 10, 8, 7, 1, 2, 3, 5
    • (iv) 10, 8, 7, 3, 2, 1, 5
    View this question on its own page →
  8. Q1i. If a problem can be solved by combining optimal solutions to non-overlapping problems, the strategy is called: - (i) dynamic programming - (ii) greedy - (iii) divide and conquer - (iv) recursion20222m

    Module 2: Divide and Conquer Paradigm and Heaps

    If a problem can be solved by combining optimal solutions to non-overlapping problems, the strategy is called:

    • (i) dynamic programming
    • (ii) greedy
    • (iii) divide and conquer
    • (iv) recursion
    View this question on its own page →
  9. Q1j. The complexity of binary search algorithm is: - (i) O(n) - (ii) O(\log n) - (iii) O(n^2) - (iv) O(n \log n)20192m

    Module 2: Divide and Conquer Paradigm and Heaps

    The complexity of binary search algorithm is:

    • (i) O(n)O(n)
    • (ii) O(logn)O(\log n)
    • (iii) O(n2)O(n^2)
    • (iv) O(nlogn)O(n \log n)
    View this question on its own page →
  10. Q2b. Write the algorithm for quick-sort and find its complexity.20237m

    Module 2: Divide and Conquer Paradigm and Heaps

    Write the algorithm for quick-sort and find its complexity.

    View this question on its own page →
  11. Q3a. Write Divide - And - Conquer Quick sort algorithm and analyze the algorithm for average time complexity.20247m

    Module 2: Divide and Conquer Paradigm and Heaps

    Write Divide - And - Conquer Quick sort algorithm and analyze the algorithm for average time complexity.

    View this question on its own page →
  12. Q3a. What are the advantages of merge-sort over the quick-sort algorithm?20197m

    Module 2: Divide and Conquer Paradigm and Heaps

    What are the advantages of merge-sort over the quick-sort algorithm?

    View this question on its own page →
  13. Q3a. Explain the working of merge sort algorithm with an example. Give the complexity calculation of merge sort.20227m

    Module 2: Divide and Conquer Paradigm and Heaps

    Explain the working of merge sort algorithm with an example. Give the complexity calculation of merge sort.

    View this question on its own page →
  14. Q3b. Simulate Quick sort algorithm for the following example 25, 36, 12, 4, 5, 16, 58, 54, 24, 16, 9, 65, 7820247m

    Module 2: Divide and Conquer Paradigm and Heaps

    Simulate Quick sort algorithm for the following example
    25, 36, 12, 4, 5, 16, 58, 54, 24, 16, 9, 65, 78

    View this question on its own page →
  15. Q3b. What is the time complexity of the matrix multiplication and Strassen's algorithm?20197m

    Module 2: Divide and Conquer Paradigm and Heaps

    What is the time complexity of the matrix multiplication and Strassen's algorithm?

    View this question on its own page →
  16. Q4a. Construct the max heap for the following: 35 33 42 10 14 19 27 44 26 3120247m

    Module 2: Divide and Conquer Paradigm and Heaps

    Construct the max heap for the following: 35 33 42 10 14 19 27 44 26 31

    View this question on its own page →
  17. Q4a. What is heap sort? What is the effect of calling MAX-HEAPIFY(A, i) when the element A[i] is larger than its children?20227m

    Module 2: Divide and Conquer Paradigm and Heaps

    What is heap sort? What is the effect of calling MAX-HEAPIFY(A, i) when the element A[i] is larger than its children?

    View this question on its own page →
  18. Q4b. Explain Strassen's matrix multiplication and its time complexity.20247m

    Module 2: Divide and Conquer Paradigm and Heaps

    Explain Strassen's matrix multiplication and its time complexity.

    View this question on its own page →
  19. Q9b. Write short notes on: Heap creation technique20237m

    Module 2: Divide and Conquer Paradigm and Heaps

    Write short notes on: Heap creation technique

    View this question on its own page →
  20. Q9c. Write short notes on: Strassen's matrix multiplication20237m

    Module 2: Divide and Conquer Paradigm and Heaps

    Write short notes on: Strassen's matrix multiplication

    View this question on its own page →