Font size
WorksheetsDAA- Tutorial
Total questions: 73
Worksheet time: 41mins
What is the Complexity of BUILD_MAX_HEAP function?
O(log n)
O(n log n)
O(n)
None of the above
Heap_Increase_key operation is used for
Increase the depth of the heap
to insert a new node in the heap with given key.
to increase the value of the given index with the new key value
to remove the max value from the heap
What is the lower bound for comparison based sorting algorithms?
nlogn
n2
logn
n
What is the order of partition algorithm in quick sort?
O(logn)
O(nlogn)
O(n)
O(1)
Order the complexity function in ascending order of their complexity
a. n
b. log n
c. n2
d. n logn
a, b, c, d
c, d, a, b
b, a, d, c
d, c, b, a
4 5 9 6 2 7
4 5 6 2 7 9
4 5 2 6 7 9
4 8 3 9 2 6
2 8 3 9 4 6
2 3 8 9 4 6
1 4 2 9 3 8 5
What does the list look like after one pass of the bubble sort algorithm.
1 4 2 9 3 8 5
What does the list look like after one pass of the selection sort algorithm.
1 4 2 9 3 8 5
What does the list look like after one pass of the insertion sort algorithm.
Which of the following is not a stable sorting algorithm?
a) Insertion sort
b) Selection sort
c) Bubble sort
d) Merge sort
Running merge sort on an array of size n which is already sorted is
a) O(n)
b) O(nlogn)
c) O(n2)
d) None
The time complexity of heap sort in worst case is
a) O(logn)
b) O(n)
c) O(nlogn)
d) O(n2)
Which of the following algorithm pays the least attention to the ordering of the elements in the input list?
a) Insertion sort
b) Selection sort
c) Quick sort
d) None
Time complexity of bubble sort in best case is
a) θ (n)
b) θ (nlogn)
c) θ (n2)
d) θ (n(logn) 2)
Which of the following is not an in-place sorting algorithm?
a) Selection sort
b) Heap sort
c) Quick sort
d) Merge sort
If a problem can be solved by combining optimal solutions to non-overlapping problems, the strategy is called _____________
Dynamic programming
Greedy
Divide and conquer
Recursion
........................... , ........................ and ...........................are the different ways in which an algorithm can be specified.
Asymptotic Notations, Flowchart, Pseudocode
English like statements, Flowchart, Pseudocode
English like statements,Sets, Pseudsocode
None of the above
Binary Search Uses
Decrease and Conquer Design Technique
Divide Conquer Design Technique
Greedy Design Technique
None of these
Efficiency of an Algorithm is decided by the
Number of times the basic operation is executed
Time taken for executing the program
Number of instructions in the program
All of these
Heap should satisfy
Shape Property
Parental Dominance Property
Both Shape and Parental Dominance Property
None of these
__________solves only subproblems that are
necessary and does so only once.
Dynamic Programming
Memory Function
Both Dynamic Programming & Memory Function
Greedy Approach
What is recurrence for worst case of QuickSort and what is the time complexity in Worst case?
Recurrence is T(n) = T(n-2) + O(n) and time complexity is O(n^2)
Recurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)
Recurrence is T(n) = 2T(n/2) + O(n) and time complexity is O(nLogn)
Recurrence is T(n) = T(n/10) + T(9n/10) + O(n) and time complexity is O(nLogn)
Binary Search Algorithm cannot be applied to
Sorted linear array
Sorted binary tree
Sorted linked list
Pointer array
Its central assumption is that instructions are executed one after another, one operation at a time.
(a)
ADT stands for?
Abstract Data Type
Algorithmic Design Technique
Algebraic Data Text
Assignment Data Transfer
It is the better implementation of a priority queue that is based on ingenious data structure.
(a)
important Properties of Graphs. (Select all that applies)
Connectivity
Acyclicity
Height
Depth
Dictionary
Execution time taken by an algorithm is evaluated while the algorithm is being executed
Posteriori Analysis
Priori Analysis
Both a and b
None
What is time complexity of fun()?
int fun(int n)
{
int count = 0;
for (int i = n; i > 0; i /= 2)
for (int j = 0; j < i; j++)
count += 1;
return count;
}
O(n2)
O(nLogn)
O(n)
O(nLognLogn)
What is the time complexity of fun()?
int fun(int n)
{
int count = 0;
for (int i = 0; i < n; i++)
for (int j = i; j > 0; j--)
count = count + 1;
return count;
}
Theta (n)
Theta (n2)
Theta (nLogn)
Theta (nLognLogn)
Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3 and f4?
f1(n) = 2^n
f2(n) = n^(3/2)
f3(n) = nLogn
f4(n) = n^(Logn)
f3, f2, f4, f1
f3, f2, f1, f4
f2, f3, f1, f4
f2, f3, f4, f1
What is the best case time complexity of fun()?
void fun(int n, int arr[])
{
int i = 0, j = 0;
for(; i < n; ++i)
while(j < n && arr[i] < arr[j])
j++;
}
O(n)
O(n2)
O(nlogn)
O(n(logn)2)
What is the complexity of the function unknown()
int unknown(int n) {
int i, j, k = 0;
for (i = n/2; i <= n; i++)
for (j = 2; j <= n; j = j * 2)
k = k + n/2;
return k;
}
𝞱(n2)
𝞱(nlogn)
𝞱(n2logn)
𝞱(n3logn)
What is the complexity of the function unknown()
int unknown(int n) {
int i, j, k = 0;
for (i = n/2; i <= n; i++)
for (j = 2; j <= n; j = j * 2)
k = k + n/2;
return k;
}
𝞱(n2)
𝞱(nlogn)
𝞱(n2logn)
𝞱(n3logn)
. What does it mean when we say that an algorithm X is asymptotically more efficient than Y?
X will be a better choice for all inputs
X will be a better choice for all inputs except small inputs
X will be a better choice for all inputs except large inputs
Y will be a better choice for small inputs
In a min-heap:
parent nodes have values less than or equal to their childs
parent nodes have values greater than or equal to their childs
parent nodes have values greater than their childs
parent nodes have values less than their childs
Time required to merge two sorted lists of size m and n, is
Ο(m | n)
Ο(m + n)
Ο(m log n)
Ο(n log m)
Index of arrays in C programming language starts from
0
1
either 0 or 1
undefined
Heap is an example of
binary search tree
spanning tree
sparse tree
complete binary tree
The right child of Binary search tree always should be
less than root node
greater than root node
should be equal to left child
none
Dijkstra’s Algorithm cannot be applied on ______________
Directed and weighted graphs
Graphs having negative weight function
Undirected graphs
None
Which Data Structure is used to perform Recursion
Queue
Stack
Linked List
Tree
Which data structure is required to convert the infix to prefix notation?
Stack
Linked List
Binary Tree
Queue
Which of the following is not the correct statement for a stack data structure?
Arrays can be used to implement the stack
Stack follows FIFO
Elements are stored in a sequential manner
Top of the Stack contains the last inserted element
Which of the following statement is not true regarding the priority queue?
Processes with different priority can be easily handled
Easy to implement
Deletion is easier
None of the above
Which one of the following is the size of int arr[9] assuming that int is of 4 bytes?
9
36
35
None
The number of elements that can be sorted in O(logn ) time using heap sort is:
O(1)
O(logn)
O(log lognlogn)
If we use Radix sort to sort n integers in the range
(n2k, nk] , for some k>0 which is independent of n, the time taken would be:O(n)
O(kn)
O(nlogn)
O(n^2)
Following algorithm can be used to sort n integers in the range
[1.......n3] in O(n) time:Heap Sort
Quick Sort
Merge Sort
Radix Sort
Consider the following sorting algorithms.
I. Quick Sort
II. Heap Sort
III. Merge Sort
Which of them perform in least time in the worst case?
I and II only
II and III only
III only
I, II and III
Which of the following is true for computation time in insertion, deletion and finding maximum and minimum element in a sorted array?
Insertion-O(1), Deletion-O(1), Maximum-O(1), Minimum-O(1)
Insertion-O(1), Deletion-O(1), Maximum-O(n), Minimum-O(n)
Insertion-O(n), Deletion-O(n), Maximum-O(1), Minimum-O(1)
Insertion-O(n), Deletion-O(n), Maximum-O(n), Minimum-O(n)
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 are TRUE?
I. QuickSort runs in O(n2) time.
II. BubbleSort runs in O(n2) time.
III. MergeSort runs in O(n) time.
IV. InsertionSort runs in O(n) time.
I and II only
I and III only
II and IV only
I and IV only
Assume that a mergesort algorithm in the worst case takes 30 seconds for an input of size 64. Which of the following most closely approximates the maximum input size of a problem that can be solved in 6 minutes?
256
512
1024
2048
Merge sort follow which strategy
(a)
Choose the recursive formula for the Fibonacci series.(n>=1)
F(n) = F(n+1) + F(n+2)
F(n) = F(n) + F(n+1)
F(n) = F(n-1) + F(n-2)
F(n) = F(n-1) – F(n-2)
Which of the following sorting algorithms is the fastest?
Merge sort
Quick sort
Insertion sort
Shell sort
Which of the following methods is the most effective for picking the pivot element?
first element
last element
median-of-three partitioning
random element
Recursion is similar to which of the following?
Switch Case
Loop
If-else
if elif else
There are two ducks in front of a duck, two ducks behind a duck and a duck in the middle. How many ducks are there?
Four
Three
रामप्रकाश की ओर संकेत करते हुये नीलम ने कहा कि-"उसके भाई का पिता मेरे दादाजी का एकमात्र पुत्र है"। नीलम का रामप्रकाश की साथ क्या रिश्ता है?
Pointing towards Ramprakash, Neelam said, "His brother's father is the only son of my grandfather". How is Neelam related to Ramprakash?
बहन
पुत्री
माँ
भेतीजी
A is the brother of B, C is the father of D, E is the mother of B. A and D are brother. How is E related to C?
Niece
Wife
Sister
Sister-in-law
X is the father of W. But W is not his son. B is the daughter of W. I is the spouse of X. O is the brother of W. D is the son of O.G is the spouse of O. H is the father of G.
i) Who is the paternal grandfather of D?
X
H
O
None Of these
Pointing to a man in a photograph, Sayali said, “His mother’s only daughter is my mother.” How is Sayali related to that man?
Nephew
Sister
Wife
Niece
Pointing to a girl in the photograph, Umesh said, “Her mother’s brother is the only son of my mother’s father.” How is the girl’s mother related to Umesh?
Mother
Sister
Aunt
Grand mother
Q is the brother of R; P is the sister of Q; T is the brother of S; S is the daughter of R. How is Q related to T?
Uncle
Father
Brother-in-law
Nephew
Pointing to a lady, Anup said, “She is the only daughter of the lady who is the mother of my mother’s only grandson”. How is the lady which is pointed related to Anup?
daughter
Wife
Sister
Mother
