PYQs

Design and Analysis of Algorithms

10 papers · 105402, 051506

2023105402

End Semester Examination - 2023

03 Hours70 marks

Instructions

  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer of the following (Any seven question only):

Ask AI
  1. Q1.1

    The fractional Knapsack problem can be solved by using

    a)

    Greedy method

    b)

    Divided and conquer method

    c)

    Dynamic programming

    d)

    None of these

    Ask AI
  2. Q1.2

    BFS on a graph $ G=(V,E) $ has running time

    a)

    O(∣V∣+∣E∣)O(|V|+|E|)

    b)

    O(∣V∣)O(|V|)

    c)

    O(∣E∣)O(|E|)

    d)

    None of the above

    Ask AI
  3. Q1.3

    The minimum number of colors needed to color a graph having $ n>3 $ vertices and 2 edges is

    a)

    2

    b)

    3

    c)

    4

    d)

    1

    Ask AI
  4. Q1.4

    Complexity the recurrence relation $ T(n)=8T(\frac{n}{2})+n^2 $ is

    a)

    O(n)O(n)

    b)

    O(n2)O(n^2)

    c)

    O(log⁡2n)O(\log_2 n)

    d)

    O(n3)O(n^3)

    Ask AI
  5. Q1.5

    Travelling salesman problem belongs to

    a)

    P class

    b)

    NP class

    c)

    NP- hard

    d)

    NP- complete class

    Ask AI
  6. Q1.6

    Kruskal's algorithm uses ___ and Prism' algorithm uses ___ in determining the MST

    a)

    Edges, vertex

    b)

    Vertex, edges

    c)

    Edges, edges

    d)

    Vertex, vertex

    Ask AI
  7. Q1.7

    Level order traversal of a rooted tree can be done by starting from root and performing

    a)

    Depth first search

    b)

    Breadth first search

    c)

    Pre-order traversal

    d)

    In-order traversal

    Ask AI
  8. Q1.8

    An algorithm is made up of two independent time complexities $ f(n) $ and $ g(n) $. Then the complexities of the algorithm is in order of

    a)

    f(n)×g(n)f(n) \times g(n)

    b)

    max⁡(f(n),g(n))\max(f(n), g(n))

    c)

    min⁡(f(n),g(n))\min(f(n), g(n))

    d)

    f(n)+g(n)f(n)+g(n)

    Ask AI
  9. Q1.9

    Which of the following standard algorithms is not a greedy algorithm?

    a)

    Dijkstra's shortest path algorithm

    b)

    Kruskal algorithm

    c)

    Bellman ford shortest path algorithm

    d)

    Prim's algorithm

    Ask AI
  10. Q1.10

    The node removal of which makes a graph disconnected is called

    a)

    Pendant vertex

    b)

    Bridge

    c)

    Articulation point

    d)

    Coloured vertex

    Ask AI

Q.2 Solve both questions :

Ask AI
  1. Q2.1

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

    Ask AI
  2. Q2.2

    Discuss the average, worst, best time complexity of the algorithm. Give suitable examples.

    Ask AI

Q.3 Solve both questions :

Ask AI
  1. Q3.1

    Construct the Huffman coding tree for the text of characters with given frequencies: T:43, I:38, V:16, K:8, L:56, E:12, O:41, Z:13, P:22, R:6.

    Ask AI
  2. Q3.2

    State the general Knapsack problem. Write a greedy algorithm for this problem and derive its time complexity.

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

    State master's theorem and find the time complexity for the following recurrence: $ T(n) = 2T(n^{1/2}) + \log n $

    Ask AI
  2. Q4.2

    What is negative weight-cycle? Write Bellman-Ford algorithm to find single source shortest distance of a directed graph.

    Ask AI

Q.5 Solve both questions :

Ask AI
  1. Q5.1

    Find the minimum number of operations required for the following matrix chain multiplication using dynamic programming: $ A(10 \times 20) * B(20 \times 50) * C(50 \times 1) * D(1 \times 100) $

    Ask AI
  2. Q5.2

    Write Knuth-Morris-Pratt algorithm for string matching problem.

    Ask AI

Q.6 Solve both questions :

Ask AI
  1. Q6.1

    Write an algorithm to find a minimum spanning tree (MST) for an undirected graph. Estimate the time complexity of your algorithm.

    Ask AI
  2. Q6.2

    Using greedy strategy. Schedule the following jobs within deadline so as to maximize the profit. Deadline and profits are mentioned as follow:
    Job i: 1, 2, 3, 4
    Deadline d: 3, 2, 3, 1
    Profit g: 9, 7, 7, 2

    Ask AI

Q.7 Solve both questions :

Ask AI
  1. Q7.1

    Write an algorithm for n-queen's problem find its time-complexity and explain the algorithm using an example.

    Ask AI
  2. Q7.2

    Solve the single source shortest path problem for the following graph considering '1' as the source vertex using Dijkstra's algorithm.

    Question Diagram
    Ask AI

Q.8 Solve all questions :

Ask AI
  1. Q8.1

    Define the classes P and NP.

    Ask AI
  2. Q8.2

    Discuss what you mean by polynomial reduction.

    Ask AI
  3. Q8.3

    Discuss diagrammatically the relation among P class, NP class, NP hard and NP complete.

    Ask AI
  4. Q8.4

    Describe Clique Decision Problem (CDP).

    Ask AI
  5. Q8.5

    Explain the max-flow min-cut theorem with an example.

    Ask AI

Q.9 Write short notes on any two of the following:

Ask AI
  1. Q9.1

    a)

    Asymptotic notations

    b)

    Heap creation technique

    c)

    Strassen's matrix multiplication

    d)

    Divide-and-Conquer vs Dynamic programming

    Ask AI

2023V2105402

End Semester Examination - 2023

03 Hours70 marks

Instructions

  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer of the following (Any seven question only):

Ask AI
  1. Q1.1

    The fractional Knapsack problem can be solved by using

    a)

    Greedy method

    b)

    Divided and conquer method

    c)

    Dynamic programming

    d)

    None of these

    Ask AI
  2. Q1.2

    BFS on a graph G=(V,E)G=(V,E) has running time

    a)

    O(∣V∣+∣E∣)O(|V|+|E|)

    b)

    O(∣V∣)O(|V|)

    c)

    O(∣E∣)O(|E|)

    d)

    None of the above

    Ask AI
  3. Q1.3

    The minimum number of colors needed to color a graph having n>3 vertices and 2 edges is

    a)

    2

    b)

    3

    c)

    4

    d)

    1

    Ask AI
  4. Q1.4

    Complexity the recurrence relation T(n)=8T(n2)+n2T(n)=8T(\frac{n}{2})+n^2 is

    a)

    O(n)O(n)

    b)

    O(n2)O(n^2)

    c)

    O(log⁡2n)O(\log_2 n)

    d)

    O(n3)O(n^3)

    Ask AI
  5. Q1.5

    Travelling salesman problem belongs to

    a)

    P class

    b)

    NP class

    c)

    NP- hard

    d)

    NP- complete class

    Ask AI
  6. Q1.6

    Kruskal's algorithm uses ___ and Prism' algorithm uses ___ in determining the MST

    a)

    Edges, vertex

    b)

    Vertex, edges

    c)

    Edges, edges

    d)

    Vertex, vertex

    Ask AI
  7. Q1.7

    Level order traversal of a rooted tree can be done by starting from root and performing

    a)

    Depth first search

    b)

    Breadth first search

    c)

    Pre-order traversal

    d)

    In-order traversal

    Ask AI
  8. Q1.8

    An algorithm is made up of two independent time complexities f(n)f(n) and g(n)g(n). Then the complexities of the algorithm is in order of

    a)

    f(n)×g(n)f(n) \times g(n)

    b)

    max⁡(f(n),g(n))\max(f(n), g(n))

    c)

    min⁡(f(n),g(n))\min(f(n), g(n))

    d)

    f(n)+g(n)f(n)+g(n)

    Ask AI
  9. Q1.9

    Which of the following standard algorithms is not a greedy algorithm?

    a)

    Dijkstra's shortest path algorithm

    b)

    Kruskal algorithm

    c)

    Bellman ford shortest path algorithm

    d)

    Prim's algorithm

    Ask AI
  10. Q1.10

    The node removal of which makes a graph disconnected is called

    a)

    Pendant vertex

    b)

    Bridge

    c)

    Articulation point

    d)

    Coloured vertex

    Ask AI

Q.2 Solve both questions :

Ask AI
  1. Q2.1

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

    Ask AI
  2. Q2.2

    Discuss the average, worst, best time complexity of the algorithm. Give suitable examples.

    Ask AI

Q.3 Solve both questions :

Ask AI
  1. Q3.1

    Construct the Huffman coding tree for the text of characters with given frequencies: T:43, I:38, V:16, K:8, L:56, E:12, O:41, Z:13, P:22, R:6.

    Ask AI
  2. Q3.2

    State the general Knapsack problem. Write a greedy algorithm for this problem and derive its time complexity.

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

    State master's theorem and find the time complexity for the following recurrence: $ T(n) = 2T(n^{1/2}) + \log n $

    Ask AI
  2. Q4.2

    What is negative weight-cycle? Write Bellman-Ford algorithm to find single source shortest distance of a directed graph.

    Ask AI

Q.5 Solve both questions :

Ask AI
  1. Q5.1

    Find the minimum number of operations required for the following matrix chain multiplication using dynamic programming: $ A(10 \times 20) * B(20 \times 50) * C(50 \times 1) * D(1 \times 100) $

    Ask AI
  2. Q5.2

    Write Knuth-Morris-Pratt algorithm for string matching problem.

    Ask AI

Q.6 Solve both questions :

Ask AI
  1. Q6.1

    Write an algorithm to find a minimum spanning tree (MST) for an undirected graph. Estimate the time complexity of your algorithm.

    Ask AI
  2. Q6.2

    Using greedy strategy. Schedule the following jobs within deadline so as to maximize the profit. Deadline and profits are mentioned as follow:
    Job i: 1, 2, 3, 4
    Deadline d: 3, 2, 3, 1
    Profit g: 9, 7, 7, 2

    Ask AI

Q.7 Solve both questions :

Ask AI
  1. Q7.1

    Write an algorithm for n-queen's problem find its time-complexity and explain the algorithm using an example.

    Ask AI
  2. Q7.2

    Solve the single source shortest path problem for the following graph considering '1' as the source vertex using Dijkstra's algorithm.

    Ask AI

Q.8 Solve all questions :

Ask AI
  1. Q8.1

    Define the classes P and NP.

    Ask AI
  2. Q8.2

    Discuss what you mean by polynomial reduction.

    Ask AI
  3. Q8.3

    Discuss diagrammatically the relation among P class, NP class, NP hard and NP complete.

    Ask AI
  4. Q8.4

    Describe Clique Decision Problem (CDP).

    Ask AI
  5. Q8.5

    Explain the max-flow min-cut theorem with an example.

    Ask AI

Q.9 Write short notes on any two of the following:

Ask AI
  1. Q9.1

    • Asymptotic notations
    • Heap creation technique
    • Strassen's matrix multiplication
    • Divide-and-Conquer vs Dynamic programming
    a)

    Asymptotic notations

    b)

    Heap creation technique

    c)

    Strassen's matrix multiplication

    d)

    Divide-and-Conquer vs Dynamic programming

    Ask AI

2022105402

B.Tech 4th Semester Exam., 2022

03 Hours70 marks

Instructions

  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer of the following (any seven) :

Ask AI
  1. Q1.1

    Any decision trees that sorts elements has height

    a)

    Ω(lg⁡n)\Omega(\lg n)

    b)

    Ω(n)\Omega(n)

    c)

    Ω(nlg⁡n)\Omega(n \lg n)

    d)

    Ω(n2)\Omega(n^2)

    Ask AI
  2. Q1.2

    Which one of the following is an application of Queue Data Structure?

    a)

    When a resource is shared among multiple consumers

    b)

    When data is transferred asynchronously between two processes

    c)

    Load balancing

    d)

    All of the above

    Ask AI
  3. Q1.3

    The complexity of binary search algorithm is

    a)

    O(n)O(n)

    b)

    O(log⁡n)O(\log n)

    c)

    O(n2)O(n^2)

    d)

    O(nlog⁡n)O(n \log n)

    Ask AI
  4. Q1.4

    In linear search algorithm the worst case occurs when

    a)

    the item is somewhere in the middle of the array

    b)

    the item is not in the array at all

    c)

    the item is the last element in the array

    d)

    the item is the last element in the array or is not there at all

    Ask AI
  5. Q1.5

    Given an unsorted array. The array has this property that every element in array is at most k distance from its position in sorted array where k is a positive integer smaller than size of array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity?

    a)

    Insertion sort with time complexity O(kn)O(kn)

    b)

    Heap sort with time complexity O(nlog⁡k)O(n \log k)

    c)

    Quick sort with time complexity O(klog⁡k)O(k \log k)

    d)

    Merge sort with time complexity O(klog⁡k)O(k \log k)

    Ask AI
  6. Q1.6

    Approach of dynamic programming is similar to

    a)

    parsing

    b)

    hash table

    c)

    divide and conquer algorithm

    d)

    greedy algorithm

    Ask AI
  7. Q1.7

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

    a)

    divide/break

    b)

    sorting/divide

    c)

    conquer/solve

    d)

    merge/combine

    Ask AI
  8. Q1.8

    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

    a)

    10, 8, 7, 5, 3, 2, 1

    b)

    10, 8, 7, 2, 3, 1, 5

    c)

    10, 8, 7, 1, 2, 3, 5

    d)

    10, 8, 7, 3, 2, 1, 5

    Ask AI
  9. Q1.9

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

    a)

    dynamic programming

    b)

    greedy

    c)

    divide and conquer

    d)

    recursion

    Ask AI
  10. Q1.10

    The choice of polynomial class has led to the development of an extensive theory called

    a)

    computational complexity

    b)

    time complexity

    c)

    problem complexity

    d)

    decision complexity

    Ask AI

Q.2 Solve both questions :

Ask AI
  1. Q2.1

    Calculate the time complexity of the following problem using divide and conquer strategies:
    (i) $ T(n) = \sqrt{n} T(\sqrt{n}) + n $, $ n > 2 $
    $ = a $, $ n \le 2 $
    (ii) $ T(n) = T(n-1) + 1/n $, $ n > 1 $
    $ = 1 $, $ n = 1 $

    Ask AI
  2. Q2.2

    Write time function and calculate the time complexity, space complexity and number of function calls of the following pseudocode using substitution method:
    rec (n) {
    if ($ n \le 1 $) return(1);
    else { rec (n/2); for ($ i=1; i \le n; i++ $) printf("algorithm"); }
    }

    Ask AI

Q.3 Solve both questions :

Ask AI
  1. Q3.1

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

    Ask AI
  2. Q3.2

    What are the rules of manipulate Big-Oh expression and about the typical growth rates of algorithms.

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

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

    Ask AI
  2. Q4.2

    Explain how radix sort works, to what inputs it can be applied and what is its asymptotic complexity?

    Ask AI

Q.5 Solve this question :

Ask AI
  1. Q5.1

    What do you mean by optimal solution in greedy approach? Define the properties and function of greedy approach. Consider the given graph $ G=(V,E) $ and find the minimum spanning tree by Prim's algorithms.

    Question Diagram
    Ask AI

Q.6 Solve this question :

Ask AI
  1. Q6.1

    Find the optimal way to multiply the following matrices to perform the fewest multiplications:
    A1: $ 5 \times 11 $, A2: $ 11 \times 4 $, A3: $ 4 \times 15 $, A4: $ 15 \times 23 $

    Ask AI

Q.7 Solve this question :

Ask AI
  1. Q7.1

    You are given a graph containing n vertices and m edges and given that the graph doesn't contain cycle of odd length. What is the time complexity of the best known algorithm to find out whether the graph is bipartite or not?

    Ask AI

Q.8 Solve this question :

Ask AI
  1. Q8.1

    What is activity selection problem? Suppose that instead of always selecting the first activity to finish, we select the last activity to start that is compatible with all previously selected activities. Describe how this approach is a greedy algorithm, and prove that it yields an optimal solution.

    Ask AI

Q.9 Write short notes on the following:

Ask AI
  1. Q9.1

    a)

    Cook's theorem

    b)

    Approximation algorithms

    Ask AI

2022V4105402

B.Tech 4th Semester Exam., 2022

03 Hours70 marks

Instructions

  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer of the following (any seven) :

Ask AI
  1. Q1.1

    Any decision trees that sorts elements has height

    a)

    Ω(lg⁡n)\Omega(\lg n)

    b)

    Ω(n)\Omega(n)

    c)

    Ω(nlg⁡n)\Omega(n \lg n)

    d)

    Ω(n2)\Omega(n^2)

    Ask AI
  2. Q1.2

    Which one of the following is an application of Queue Data Structure?

    a)

    When a resource is shared among multiple consumers

    b)

    When data is transferred asynchronously between two processes

    c)

    Load balancing

    d)

    All of the above

    Ask AI
  3. Q1.3

    The complexity of binary search algorithm is

    a)

    O(n)O(n)

    b)

    O(log⁡n)O(\log n)

    c)

    O(n2)O(n^2)

    d)

    O(nlog⁡n)O(n \log n)

    Ask AI
  4. Q1.4

    In linear search algorithm the worst case occurs when

    a)

    the item is somewhere in the middle of the array

    b)

    the item is not in the array at all

    c)

    the item is the last element in the array

    d)

    the item is the last element in the array or is not there at all

    Ask AI
  5. Q1.5

    Given an unsorted array. The array has this property that every element in array is at most k distance from its position in sorted array where k is a positive integer smaller than size of array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity?

    a)

    Insertion sort with time complexity O(kn)O(kn)

    b)

    Heap sort with time complexity O(nlog⁡k)O(n \log k)

    c)

    Quick sort with time complexity O(klog⁡k)O(k \log k)

    d)

    Merge sort with time complexity O(klog⁡k)O(k \log k)

    Ask AI
  6. Q1.6

    Approach of dynamic programming is similar to

    a)

    parsing

    b)

    hash table

    c)

    divide and conquer algorithm

    d)

    greedy algorithm

    Ask AI
  7. Q1.7

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

    a)

    divide/break

    b)

    sorting/divide

    c)

    conquer/solve

    d)

    merge/combine

    Ask AI
  8. Q1.8

    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

    a)

    10, 8, 7, 5, 3, 2, 1

    b)

    10, 8, 7, 2, 3, 1, 5

    c)

    10, 8, 7, 1, 2, 3, 5

    d)

    10, 8, 7, 3, 2, 1, 5

    Ask AI
  9. Q1.9

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

    a)

    dynamic programming

    b)

    greedy

    c)

    divide and conquer

    d)

    recursion

    Ask AI
  10. Q1.10

    The choice of polynomial class has led to the development of an extensive theory called

    a)

    computational complexity

    b)

    time complexity

    c)

    problem complexity

    d)

    decision complexity

    Ask AI

Q.2 Solve both questions :

Ask AI
  1. Q2.1

    Calculate the time complexity of the following problem using divide and conquer strategies:
    (i) $ T(n) = \sqrt{n} T(\sqrt{n}) + n $, $ n > 2 $
    $ = a $, $ n \le 2 $
    (ii) $ T(n) = T(n-1) + 1/n $, $ n > 1 $
    $ = 1 $, $ n = 1 $

    Ask AI
  2. Q2.2

    Write time function and calculate the time complexity, space complexity and number of function calls of the following pseudocode using substitution method:
    rec (n) {
    if ($ n \le 1 $) return(1);
    else { rec (n/2); for ($ i=1; i \le n; i++ $) printf("algorithm"); }
    }

    Ask AI

Q.3 Solve both questions :

Ask AI
  1. Q3.1

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

    Ask AI
  2. Q3.2

    What are the rules of manipulate Big-Oh expression and about the typical growth rates of algorithms.

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

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

    Ask AI
  2. Q4.2

    Explain how radix sort works, to what inputs it can be applied and what is its asymptotic complexity?

    Ask AI

Q.5 Solve this question :

Ask AI
  1. Q5.1

    What do you mean by optimal solution in greedy approach? Define the properties and function of greedy approach. Consider the given graph $ G=(V,E) $ and find the minimum spanning tree by Prim's algorithms.

    Question Diagram
    Ask AI

Q.6 Solve this question :

Ask AI
  1. Q6.1

    Find the optimal way to multiply the following matrices to perform the fewest multiplications:
    A1: $ 5 \times 11 $, A2: $ 11 \times 4 $, A3: $ 4 \times 15 $, A4: $ 15 \times 23 $

    Ask AI

Q.7 Solve this question :

Ask AI
  1. Q7.1

    You are given a graph containing n vertices and m edges and given that the graph doesn't contain cycle of odd length. What is the time complexity of the best known algorithm to find out whether the graph is bipartite or not?

    Ask AI

Q.8 Solve this question :

Ask AI
  1. Q8.1

    What is activity selection problem? Suppose that instead of always selecting the first activity to finish, we select the last activity to start that is compatible with all previously selected activities. Describe how this approach is a greedy algorithm, and prove that it yields an optimal solution.

    Ask AI

Q.9 Write short notes on the following:

Ask AI

2020051506

B.Tech 5th Semester Special Exam., 2020

03 Hours70 marks

Instructions

  • The marks are indicated in the right-hand margin.
  • There are EIGHT questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer of the following (any seven):

Ask AI
  1. Q1.1

    Find the complexity of the below program:
    void function(int n) { int i=1, s=1; while(s<=n) { i++; s+=i; printf("*"); } }

    a)

    Ω(n)\Omega(n)

    b)

    O(n)O(\sqrt{n})

    c)

    Θ(loglogn)\Theta(loglogn)

    d)

    Θ(sqrt(n))\Theta(sqrt(n))

    Ask AI
  2. Q1.2

    How many undirected graphs (not necessarily connected) can be constructed out of a given set $ V = \{V_1, V_2, \dots, V_n\} $ of n vertices?

    a)

    n(n−1)/2n(n-1)/2

    b)

    2n2^n

    c)

    n!n!

    d)

    2n(n−1)/22^{n(n-1)/2}

    Ask AI
  3. Q1.3

    The recurrence relation capturing the optimal time of the Tower of Hanoi problem with n discs is

    a)

    T(n)=2T(n−2)+2T(n)=2T(n-2)+2

    b)

    T(n)=2T(n−1)+nT(n)=2T(n-1)+n

    c)

    T(n)=2T(n/2)+1T(n)=2T(n/2)+1

    d)

    T(n)=2T(n−1)+1T(n)=2T(n-1)+1

    Ask AI
  4. Q1.4

    Dijkstra's algorithm is based on

    a)

    dynamic programming

    b)

    divide and conquer

    c)

    greedy programming

    d)

    None of the above

    Ask AI
  5. Q1.5

    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?

    a)

    O(n)O(n)

    b)

    O(n2)O(n^2)

    c)

    O(nlog⁡n)O(n \log n)

    d)

    O(n!)O(n!)

    Ask AI
  6. Q1.6

    Name three sorting algorithms which are stable by nature.

    a)

    Bubble sort, Insertion sort, Merge sort

    b)

    Bubble sort, Quick sort, Heap sort

    c)

    Insertion sort, Radix sort, Heap sort

    d)

    Count sort, Radix sort, Quick sort

    Ask AI
  7. Q1.7

    What is the worst time complexity of insertion sort?

    a)

    nlog⁡nn \log n

    b)

    log⁡n\log n

    c)

    nn

    d)

    n2n^2

    Ask AI
  8. Q1.8

    The most efficient algorithm for finding the number of connected components in an undirected graph of n vertices and m edges has the time complexity

    a)

    O(n)O(n)

    b)

    O(m)O(m)

    c)

    O(m+n)O(m+n)

    d)

    O(mn)O(mn)

    Ask AI
  9. Q1.9

    Which of the following statement is not true about breadth-first search (BFS) in an undirected graph starting at a vertex v?

    a)

    BFS identifies all vertices reachable from v.

    b)

    Using an adjacency list instead of an adjacency matrix can improve the worst case complexity to O(n+m)O(n+m).

    c)

    BFS cannot be used to check for cycles in the graph.

    d)

    BFS can be used to identify the furthest vertex from v in any graph, in terms of number of nodes.

    Ask AI
  10. Q1.10

    Finding the location of the element with a given value is

    a)

    traversal

    b)

    search

    c)

    sort

    d)

    None of the above

    Ask AI

Q.2 Solve this question :

Ask AI
  1. Q2.1

    Write the asymptomatic notation used for best case, average case and worst case analysis of algorithm. Write an algorithm for finding maximum element in an array. Give best, worst and average case complexities.

    Ask AI

Q.3 Solve both questions :

Ask AI
  1. Q3.1

    Explain the brute force method to find the two closet points in a set of n points in k-dimensional space.

    Ask AI
  2. Q3.2

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

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

    Write an algorithm based on divide-and-conquer strategy to search an element in a given list. Assume that the elements of list are in sorted order.

    Ask AI
  2. Q4.2

    What is the relationship among P, NP and NP-complete problems? Show with the help of a diagram.

    Ask AI

Q.5 Solve this question :

Ask AI
  1. Q5.1

    Give the complete solution (step-by-step using state space tree) for N-Queen problem using back-tracking with pseudocode. Give the complexity analysis.

    Ask AI

Q.6 Solve this question :

Ask AI
  1. Q6.1

    Construct the Huffman coding tree for the text of characters with given frequencies: T:43, I:38, V:16, K:8, L:56, E:12, O:41, Z:13, P:22, R:6. Also find the variable length Huffman codes and frequency path length for corresponding above characters.

    Ask AI

Q.7 Solve this question :

Ask AI
  1. Q7.1

    Find the optimal way to multiply the following matrices to perform the fewest multiplications:
    $ A_1: 5 \times 11 $, $ A_2: 11 \times 4 $, $ A_3: 4 \times 15 $, $ A_4: 15 \times 23 $

    Ask AI

Q.8 Write short notes on the following:

Ask AI
  1. Q8.1

    a)

    Travelling salesman problem

    b)

    Activity selection problem

    c)

    Monte Carlo types

    d)

    Divide-and-Conquer vs. Dynamic programming

    Ask AI

2020SPECIAL051506

B.Tech 5th Semester Special Exam., 2020

03 Hours70 marks

Instructions

  • The marks are indicated in the right-hand margin.
  • There are EIGHT questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer of the following (any seven):

Ask AI
  1. Q1.1

    Find the complexity of the below program:
    void function(int n) { int i=1, s=1; while(s<=n) { i++; s+=i; printf("*"); } }

    a)

    Ω(n)\Omega(n)

    b)

    O(n)O(\sqrt{n})

    c)

    Θ(loglogn)\Theta(loglogn)

    d)

    Θ(sqrt(n))\Theta(sqrt(n))

    Ask AI
  2. Q1.2

    How many undirected graphs (not necessarily connected) can be constructed out of a given set $ V = \\{V_1, V_2, \dots, V_n\\} $ of n vertices?

    a)

    n(n−1)/2n(n-1)/2

    b)

    2n2^n

    c)

    n!n!

    d)

    2n(n−1)/22^{n(n-1)/2}

    Ask AI
  3. Q1.3

    The recurrence relation capturing the optimal time of the Tower of Hanoi problem with n discs is

    a)

    T(n)=2T(n−2)+2T(n)=2T(n-2)+2

    b)

    T(n)=2T(n−1)+nT(n)=2T(n-1)+n

    c)

    T(n)=2T(n/2)+1T(n)=2T(n/2)+1

    d)

    T(n)=2T(n−1)+1T(n)=2T(n-1)+1

    Ask AI
  4. Q1.4

    Dijkstra's algorithm is based on

    a)

    dynamic programming

    b)

    divide and conquer

    c)

    greedy programming

    d)

    None of the above

    Ask AI
  5. Q1.5

    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?

    a)

    O(n)O(n)

    b)

    O(n2)O(n^2)

    c)

    O(nlog⁡n)O(n \log n)

    d)

    O(n!)O(n!)

    Ask AI
  6. Q1.6

    Name three sorting algorithms which are stable by nature.

    a)

    Bubble sort, Insertion sort, Merge sort

    b)

    Bubble sort, Quick sort, Heap sort

    c)

    Insertion sort, Radix sort, Heap sort

    d)

    Count sort, Radix sort, Quick sort

    Ask AI
  7. Q1.7

    What is the worst time complexity of insertion sort?

    a)

    nlog⁡nn \log n

    b)

    log⁡n\log n

    c)

    nn

    d)

    n2n^2

    Ask AI
  8. Q1.8

    The most efficient algorithm for finding the number of connected components in an undirected graph of n vertices and m edges has the time complexity

    a)

    O(n)O(n)

    b)

    O(m)O(m)

    c)

    O(m+n)O(m+n)

    d)

    O(mn)O(mn)

    Ask AI
  9. Q1.9

    Which of the following statement is not true about breadth-first search (BFS) in an undirected graph starting at a vertex v?

    a)

    BFS identifies all vertices reachable from v.

    b)

    Using an adjacency list instead of an adjacency matrix can improve the worst case complexity to O(n+m)O(n+m).

    c)

    BFS cannot be used to check for cycles in the graph.

    d)

    BFS can be used to identify the furthest vertex from v in any graph, in terms of number of nodes.

    Ask AI
  10. Q1.10

    Finding the location of the element with a given value is

    a)

    traversal

    b)

    search

    c)

    sort

    d)

    None of the above

    Ask AI

Q.2 Solve this question :

Ask AI
  1. Q2.1

    Write the asymptomatic notation used for best case, average case and worst case analysis of algorithm. Write an algorithm for finding maximum element in an array. Give best, worst and average case complexities.

    Ask AI

Q.3 Solve both questions :

Ask AI
  1. Q3.1

    Explain the brute force method to find the two closet points in a set of n points in k-dimensional space.

    Ask AI
  2. Q3.2

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

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

    Write an algorithm based on divide-and-conquer strategy to search an element in a given list. Assume that the elements of list are in sorted order.

    Ask AI
  2. Q4.2

    What is the relationship among P, NP and NP-complete problems? Show with the help of a diagram.

    Ask AI

Q.5 Solve this question :

Ask AI
  1. Q5.1

    Give the complete solution (step-by-step using state space tree) for N-Queen problem using back-tracking with pseudocode. Give the complexity analysis.

    Ask AI

Q.6 Solve this question :

Ask AI
  1. Q6.1

    Construct the Huffman coding tree for the text of characters with given frequencies: T:43, I:38, V:16, K:8, L:56, E:12, O:41, Z:13, P:22, R:6. Also find the variable length Huffman codes and frequency path length for corresponding above characters.

    Ask AI

Q.7 Solve this question :

Ask AI
  1. Q7.1

    Find the optimal way to multiply the following matrices to perform the fewest multiplications:
    $ A_1: 5 \times 11 $, $ A_2: 11 \times 4 $, $ A_3: 4 \times 15 $, $ A_4: 15 \times 23 $

    Ask AI

Q.8 Write short notes on the following:

Ask AI

2019051506

B.Tech 5th Semester Exam., 2019

03 Hours70 marks

Instructions

  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer from any seven of the following:

Ask AI
  1. Q1.1

    In the following C++ function, let $ n \ge m $. What is the time complexity of the above function assuming $ n > m $?
    int gcd(int n, int m) { if(n%m==0) return m; if(n < m) swap(n, m); while(m>0) { n=n%m; swap(n, m); } return n; }

    a)

    Θ(log⁡n)\Theta(\log n)

    b)

    Ω(n)\Omega(n)

    c)

    Θ(loglogn)\Theta(loglogn)

    d)

    Θ(sqrt(n))\Theta(sqrt(n))

    Ask AI
  2. Q1.2

    Time complexity of Kadane's Algorithm is

    a)

    O(n)O(n)

    b)

    O(n2)O(n^2)

    c)

    O(nlog⁡n)O(n \log n)

    d)

    O(n(log⁡n)2)O(n(\log n)^2)

    Ask AI
  3. Q1.3

    Consider an undirected random graph of eight vertices. The probability that there is an edge between a pair of vertices is 1/2. What is the expected number of unordered cycles of length three?

    a)

    1/81/8

    b)

    11

    c)

    77

    d)

    88

    Ask AI
  4. Q1.4

    Any decision tree that sorts 'n' elements has height

    a)

    Ω(lg⁡n)\Omega(\lg n)

    b)

    Ω(n)\Omega(n)

    c)

    Ω(nlg⁡n)\Omega(n \lg n)

    d)

    Ω(n2)\Omega(n^2)

    Ask AI
  5. Q1.5

    An all-pairs shortest-paths problem is efficiently solved using

    a)

    Dijkstra's algorithm

    b)

    Bellman-Ford algorithm

    c)

    Kruskal algorithm

    d)

    Floyd-Warshall algorithm

    Ask AI
  6. Q1.6

    Which of the following is an advantage of adjacency list representation over adjacency matrix representation of a graph?

    a)

    In adjacency list representation, space is saved for sparse graphs.

    b)

    DFS and BFS can be done in O(V+E)O(V+E) time for adjacency list representation.

    c)

    Adding a vertex in adjacency list representation is easier than adjacency matrix representation.

    d)

    All of the above

    Ask AI
  7. Q1.7

    Which of the following is true about Huffman Coding?

    a)

    Huffman coding may become lossy in some cases.

    b)

    Huffman codes may not be optimal lossless codes in some cases.

    c)

    In Huffman coding, no code is prefix of any other code.

    d)

    All of the above

    Ask AI
  8. Q1.8

    Which one of the following is an application of Queue Data Structure?

    a)

    When a resource is shared among multiple consumers

    b)

    When data is transferred asynchronously between two processes

    c)

    Load balancing

    d)

    All of the above

    Ask AI
  9. Q1.9

    In linear search algorithm the worst case occurs when

    a)

    the item is somewhere in the middle of the array

    b)

    the item is not in the array at all

    c)

    the item is the last element in the array

    d)

    the item is the last element in the array or is not there at all

    Ask AI
  10. Q1.10

    The complexity of binary search algorithm is

    a)

    O(n)O(n)

    b)

    O(log⁡n)O(\log n)

    c)

    O(n2)O(n^2)

    d)

    O(nlog⁡n)O(n \log n)

    Ask AI

Q.2 Solve both questions :

Ask AI
  1. Q2.1

    Discuss the steps in mathematical analysis for recursive algorithm. Do the same for finding the factorial of a number?

    Ask AI
  2. Q2.2

    What are the rules of manipulate Big-Oh expression? Write about the typical growth rates of algorithms.

    Ask AI

Q.3 Solve both questions :

Ask AI
  1. Q3.1

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

    Ask AI
  2. Q3.2

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

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

    Prove that if $ f_1(n) = O(g_1(n)) $ and $ f_2(n) = O(g_2(n)) $, then $ f_1(n)+f_2(n) = O(g_1(n)+g_2(n)) $.

    Ask AI

Q.5 Solve this question :

Ask AI
  1. Q5.1

    What is the relationship among P, NP and NP complete problems? Show with the help of a diagram.

    Ask AI
  2. Q5.2

    Compare the various programming paradigms such as divide-and-conquer, dynamic programming and greedy approach.

    Ask AI

Q.6 Solve this question :

Ask AI
  1. Q6.1

    Consider the array A = {26, 17, 41, 14, 21, 30, 47, 10, 16, 19, 21, 28, 38, 7, 12, 14, 20, 35, 39, 3}. Create binary search tree with one more attributes its size of node. Retrieve 17th smallest element in the tree and rank the 12th element.

    Ask AI

Q.7 Solve this question :

Ask AI
  1. Q7.1

    What do you mean by optimal solution in greedy approach? Define the properties and function of greedy approach. Consider a graph $ G=(V,E) $ and find the minimum spanning tree by Prim's algorithms.

    Question Diagram
    Ask AI

Q.8 Solve this question :

Ask AI
  1. Q8.1

    Explain back-tracking, DFS and BFS with help of small example. Differentiate in between backtracking and dynamic programming. Apply the backtracking algorithm to solve the three-colouring problem for the graph using state space tree. Assume three colours red, green and blue.

    Question Diagram
    Ask AI

Q.9 Write short notes on:

Ask AI
  1. Q9.1

    a)

    Kruskal algorithms

    b)

    Branch and bound technique

    c)

    Amortized analysis

    d)

    Divide-N-Conquer VS Dynamic Programming

    Ask AI

2019V4051506

B.Tech 5th Semester Exam., 2019

03 Hours70 marks

Instructions

  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer from any seven of the following:

Ask AI
  1. Q1.1

    In the following C++ function, let $ n \ge m $. What is the time complexity of the above function assuming $ n > m $?
    int gcd(int n, int m) { if(n%m==0) return m; if(n < m) swap(n, m); while(m>0) { n=n%m; swap(n, m); } return n; }

    a)

    Θ(log⁡n)\Theta(\log n)

    b)

    Ω(n)\Omega(n)

    c)

    Θ(loglogn)\Theta(loglogn)

    d)

    Θ(sqrt(n))\Theta(sqrt(n))

    Ask AI
  2. Q1.2

    Time complexity of Kadane's Algorithm is

    a)

    O(n)O(n)

    b)

    O(n2)O(n^2)

    c)

    O(nlog⁡n)O(n \log n)

    d)

    O(n(log⁡n)2)O(n(\log n)^2)

    Ask AI
  3. Q1.3

    Consider an undirected random graph of eight vertices. The probability that there is an edge between a pair of vertices is 1/2. What is the expected number of unordered cycles of length three?

    a)

    1/81/8

    b)

    11

    c)

    77

    d)

    88

    Ask AI
  4. Q1.4

    Any decision tree that sorts 'n' elements has height

    a)

    Ω(lg⁡n)\Omega(\lg n)

    b)

    Ω(n)\Omega(n)

    c)

    Ω(nlg⁡n)\Omega(n \lg n)

    d)

    Ω(n2)\Omega(n^2)

    Ask AI
  5. Q1.5

    An all-pairs shortest-paths problem is efficiently solved using

    a)

    Dijkstra's algorithm

    b)

    Bellman-Ford algorithm

    c)

    Kruskal algorithm

    d)

    Floyd-Warshall algorithm

    Ask AI
  6. Q1.6

    Which of the following is an advantage of adjacency list representation over adjacency matrix representation of a graph?

    a)

    In adjacency list representation, space is saved for sparse graphs.

    b)

    DFS and BFS can be done in O(V+E)O(V+E) time for adjacency list representation.

    c)

    Adding a vertex in adjacency list representation is easier than adjacency matrix representation.

    d)

    All of the above

    Ask AI
  7. Q1.7

    Which of the following is true about Huffman Coding?

    a)

    Huffman coding may become lossy in some cases.

    b)

    Huffman codes may not be optimal lossless codes in some cases.

    c)

    In Huffman coding, no code is prefix of any other code.

    d)

    All of the above

    Ask AI
  8. Q1.8

    Which one of the following is an application of Queue Data Structure?

    a)

    When a resource is shared among multiple consumers

    b)

    When data is transferred asynchronously between two processes

    c)

    Load balancing

    d)

    All of the above

    Ask AI
  9. Q1.9

    In linear search algorithm the worst case occurs when

    a)

    the item is somewhere in the middle of the array

    b)

    the item is not in the array at all

    c)

    the item is the last element in the array

    d)

    the item is the last element in the array or is not there at all

    Ask AI
  10. Q1.10

    The complexity of binary search algorithm is

    a)

    O(n)O(n)

    b)

    O(log⁡n)O(\log n)

    c)

    O(n2)O(n^2)

    d)

    O(nlog⁡n)O(n \log n)

    Ask AI

Q.2 Solve both questions :

Ask AI
  1. Q2.1

    Discuss the steps in mathematical analysis for recursive algorithm. Do the same for finding the factorial of a number?

    Ask AI
  2. Q2.2

    What are the rules of manipulate Big-Oh expression? Write about the typical growth rates of algorithms.

    Ask AI

Q.3 Solve both questions :

Ask AI
  1. Q3.1

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

    Ask AI
  2. Q3.2

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

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

    Prove that if $ f_1(n) = O(g_1(n)) $ and $ f_2(n) = O(g_2(n)) $, then $ f_1(n)+f_2(n) = O(g_1(n)+g_2(n)) $.

    Ask AI

Q.5 Solve this question :

Ask AI
  1. Q5.1

    What is the relationship among P, NP and NP complete problems? Show with the help of a diagram.

    Ask AI
  2. Q5.2

    Compare the various programming paradigms such as divide-and-conquer, dynamic programming and greedy approach.

    Ask AI

Q.6 Solve this question :

Ask AI
  1. Q6.1

    Consider the array A = {26, 17, 41, 14, 21, 30, 47, 10, 16, 19, 21, 28, 38, 7, 12, 14, 20, 35, 39, 3}. Create binary search tree with one more attributes its size of node. Retrieve 17th smallest element in the tree and rank the 12th element.

    Ask AI

Q.7 Solve this question :

Ask AI
  1. Q7.1

    What do you mean by optimal solution in greedy approach? Define the properties and function of greedy approach. Consider a graph $ G=(V,E) $ and find the minimum spanning tree by Prim's algorithms.

    Question Diagram
    Ask AI

Q.8 Solve this question :

Ask AI
  1. Q8.1

    Explain back-tracking, DFS and BFS with help of small example. Differentiate in between backtracking and dynamic programming. Apply the backtracking algorithm to solve the three-colouring problem for the graph using state space tree. Assume three colours red, green and blue.

    Question Diagram
    Ask AI

Q.9 Write short notes on:

Ask AI

2018051506

B.Tech 5th Semester Exam., 2018

03 Hours70 marks

Instructions

  • All questions carry equal marks.
  • There are NINE questions in this paper.
  • Attempt any FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer (any seven):

Ask AI
  1. Q1.1

    Which algorithm is better for sorting between bubble sort and quicksort?

    a)

    Bubble sort

    b)

    Quicksort

    c)

    Both are equally good

    d)

    These cannot be compared

    Ask AI
  2. Q1.2

    An algorithm which uses the past results and uses them to find the new results is

    a)

    brute force

    b)

    divide and conquer

    c)

    dynamic programming algorithm

    d)

    None of the mentioned

    Ask AI
  3. Q1.3

    Out of the following which property of algorithm does not share?

    a)

    Input

    b)

    Finiteness

    c)

    Generality

    d)

    Constancy

    Ask AI
  4. Q1.4

    Which of the following standard algorithms is not a greedy algorithm?

    a)

    Dijkstra's shortest path algorithm

    b)

    Kruskal algorithm

    c)

    Bellmen Ford shortest path algorithm

    d)

    Prim's algorithm

    Ask AI
  5. Q1.5

    What is the time complexity of Huffman coding?

    a)

    O(N)O(N)

    b)

    O(Nlog⁡N)O(N \log N)

    c)

    O(N(log⁡N)2)O(N(\log N)^2)

    d)

    O(N2)O(N^2)

    Ask AI
  6. Q1.6

    How many comparisons are required to sort the list 1, 2, 3... n using insertion sort?

    a)

    (n2+n+2)/2(n^2+n+2)/2

    b)

    (n3+n−2)/2(n^3+n-2)/2

    c)

    (n2+n−2)/2(n^2+n-2)/2

    d)

    (n2−n−2)/2(n^2-n-2)/2

    Ask AI
  7. Q1.7

    Which of the following is true about Huffman coding?

    a)

    Huffman coding may become lossy in some cases

    b)

    Huffman codes may not be optimal lossless codes in some cases

    c)

    In Huffman coding, no code is prefix of any other code

    d)

    All of the above

    Ask AI
  8. Q1.8

    A complexity of algorithm depends upon

    a)

    time only

    b)

    space only

    c)

    both time and space

    d)

    None of the mentioned

    Ask AI
  9. Q1.9

    A text is made up of the characters a, b, c, d, e each occurring with the probability 0.11, 0.40, 0.16, 0.09 and 0.24 respectively. The optimal Huffman coding technique will have the average length of

    a)

    2.40

    b)

    2.16

    c)

    2.26

    d)

    2.15

    Ask AI
  10. Q1.10

    Build heap is used in heap sort as a first step for sorting. What is the time complexity of build heap operation?

    a)

    O(nlog⁡n)O(n \log n)

    b)

    O(n2)O(n^2)

    c)

    O(log⁡n)O(\log n)

    d)

    O(n)O(n)

    Ask AI

Q.2 Solve this question :

Ask AI
  1. Q2.1

    Solve the following recurrence by successive substitution method:
    $ f(1) = 1 $, if $ n=1 $
    $ f(n) = 3f(n/2) + 6 $, if $ n>1 $

    Ask AI

Q.3 Solve this question :

Ask AI
  1. Q3.1

    COUNTING SORT algorithm assumes that each of the n input elements is an integer in the range 0 to k, for some integer k. When $ k=O(n) $, the sort runs in $ \Theta(n) $ time. Change COUNTING SORT algorithm for the numbers lying in the range p to q where $ (q-p) $ is still $ O(n) $. Also analyze the new complexity.

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

    Consider a directed acyclic graph with non-negative edge costs and with a given start vertex s. Write an algorithm to compute distances from source s in $ O(E+V) $ time. Justify why your algorithm is correct.

    Ask AI
  2. Q4.2

    Explain, with an example, why Dijkstra's algorithm might take $ \Omega(V \log V) $ time.

    Ask AI

Q.5 Solve this question :

Ask AI
  1. Q5.1

    Consider the two standard representations of directed graphs: the adjacency-list representation and the adjacency-matrix representation. Find a problem that can be solved more efficiently in the adjacency-list representation than in the adjacency-matrix representation, and another problem that can be solved more efficiently in the adjacency-matrix representation than in the adjacency-list representation.

    Ask AI

Q.6 Solve both questions :

Ask AI
  1. Q6.1

    Differentiate between the following: Fractional Knapsack vs. 0/1 Knapsack.

    Ask AI
  2. Q6.2

    Differentiate between the following: Kruskal's vs. Prim's Algorithm.

    Ask AI

Q.7 Solve this question :

Ask AI
  1. Q7.1

    What are NP-complete problems? Write some problems which are P, NP and NP-hard. Explain any NP-hard problem in detail.

    Ask AI

Q.8 Solve this question :

Ask AI
  1. Q8.1

    Explain quicksort and its asymptotic complexities. Take some distinct numbers and perform quicksort over it.

    Ask AI

Q.9 Solve both questions :

Ask AI
  1. Q9.1

    Explain travelling salesman problem using Greedy method.

    Ask AI
  2. Q9.2

    Explain travelling salesman problem using Dynamic programming method.

    Ask AI

2018V4051506

B.Tech 5th Semester Exam., 2018

03 Hours70 marks

Instructions

  • All questions carry equal marks.
  • There are NINE questions in this paper.
  • Attempt any FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer (any seven):

Ask AI
  1. Q1.1

    Which algorithm is better for sorting between bubble sort and quicksort?

    a)

    Bubble sort

    b)

    Quicksort

    c)

    Both are equally good

    d)

    These cannot be compared

    Ask AI
  2. Q1.2

    An algorithm which uses the past results and uses them to find the new results is

    a)

    brute force

    b)

    divide and conquer

    c)

    dynamic programming algorithm

    d)

    None of the mentioned

    Ask AI
  3. Q1.3

    Out of the following which property of algorithm does not share?

    a)

    Input

    b)

    Finiteness

    c)

    Generality

    d)

    Constancy

    Ask AI
  4. Q1.4

    Which of the following standard algorithms is not a greedy algorithm?

    a)

    Dijkstra's shortest path algorithm

    b)

    Kruskal algorithm

    c)

    Bellmen Ford shortest path algorithm

    d)

    Prim's algorithm

    Ask AI
  5. Q1.5

    What is the time complexity of Huffman coding?

    a)

    O(N)O(N)

    b)

    O(Nlog⁡N)O(N \log N)

    c)

    O(N(log⁡N)2)O(N(\log N)^2)

    d)

    O(N2)O(N^2)

    Ask AI
  6. Q1.6

    How many comparisons are required to sort the list 1, 2, 3... n using insertion sort?

    a)

    (n2+n+2)/2(n^2+n+2)/2

    b)

    (n3+n−2)/2(n^3+n-2)/2

    c)

    (n2+n−2)/2(n^2+n-2)/2

    d)

    (n2−n−2)/2(n^2-n-2)/2

    Ask AI
  7. Q1.7

    Which of the following is true about Huffman coding?

    a)

    Huffman coding may become lossy in some cases

    b)

    Huffman codes may not be optimal lossless codes in some cases

    c)

    In Huffman coding, no code is prefix of any other code

    d)

    All of the above

    Ask AI
  8. Q1.8

    A complexity of algorithm depends upon

    a)

    time only

    b)

    space only

    c)

    both time and space

    d)

    None of the mentioned

    Ask AI
  9. Q1.9

    A text is made up of the characters a, b, c, d, e each occurring with the probability 0.11, 0.40, 0.16, 0.09 and 0.24 respectively. The optimal Huffman coding technique will have the average length of

    a)

    2.40

    b)

    2.16

    c)

    2.26

    d)

    2.15

    Ask AI
  10. Q1.10

    Build heap is used in heap sort as a first step for sorting. What is the time complexity of build heap operation?

    a)

    O(nlog⁡n)O(n \log n)

    b)

    O(n2)O(n^2)

    c)

    O(log⁡n)O(\log n)

    d)

    O(n)O(n)

    Ask AI

Q.2 Solve this question :

Ask AI
  1. Q2.1

    Solve the following recurrence by successive substitution method:
    $ f(1) = 1 $, if $ n=1 $
    $ f(n) = 3f(n/2) + 6 $, if $ n>1 $

    Ask AI

Q.3 Solve this question :

Ask AI
  1. Q3.1

    COUNTING SORT algorithm assumes that each of the n input elements is an integer in the range 0 to k, for some integer k. When $ k=O(n) $, the sort runs in $ \Theta(n) $ time. Change COUNTING SORT algorithm for the numbers lying in the range p to q where $ (q-p) $ is still $ O(n) $. Also analyze the new complexity.

    Ask AI

Q.4 Solve both questions :

Ask AI
  1. Q4.1

    Consider a directed acyclic graph with non-negative edge costs and with a given start vertex s. Write an algorithm to compute distances from source s in $ O(E+V) $ time. Justify why your algorithm is correct.

    Ask AI
  2. Q4.2

    Explain, with an example, why Dijkstra's algorithm might take $ \Omega(V \log V) $ time.

    Ask AI

Q.5 Solve this question :

Ask AI
  1. Q5.1

    Consider the two standard representations of directed graphs: the adjacency-list representation and the adjacency-matrix representation. Find a problem that can be solved more efficiently in the adjacency-list representation than in the adjacency-matrix representation, and another problem that can be solved more efficiently in the adjacency-matrix representation than in the adjacency-list representation.

    Ask AI

Q.6 Solve both questions :

Ask AI
  1. Q6.1

    Differentiate between the following: Fractional Knapsack vs. 0/1 Knapsack.

    Ask AI
  2. Q6.2

    Differentiate between the following: Kruskal's vs. Prim's Algorithm.

    Ask AI

Q.7 Solve this question :

Ask AI
  1. Q7.1

    What are NP-complete problems? Write some problems which are P, NP and NP-hard. Explain any NP-hard problem in detail.

    Ask AI

Q.8 Solve this question :

Ask AI
  1. Q8.1

    Explain quicksort and its asymptotic complexities. Take some distinct numbers and perform quicksort over it.

    Ask AI

Q.9 Solve both questions :

Ask AI
  1. Q9.1

    Explain travelling salesman problem using Greedy method.

    Ask AI
  2. Q9.2

    Explain travelling salesman problem using Dynamic programming method.

    Ask AI

Support BEUConnect

Contributions cover the domain and hosting.

UPI QR code for pritkr@cnrb
pritkr@cnrb

Add to home screen

  1. Tap Share in Safari.
  2. Choose Add to Home Screen.