WorksheetsDAA Tutorial-1
Total questions: 32
Worksheet time: 16mins
Which one of the following correctly determines the solution of the recurrence relation with T(1) = 1?
T(1) = 2T (n/2) + log n
θ(n)
θ(n logn)
θ(n2)
θ(logn)
The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:
θ(n logn), θ(n logn),θ(n2)
θ(n2),θ(n2), θ(nlogn)
θ(n2), θ(n logn), θ(n logn)
θ(n2), θ(n logn),θ(n2)
To main measures of the efficiency of an algorithm are?
time and space complexity
data and space
processor and memory
complexity and capacity
Which of the following data structure is used to perform recursion?
linked list
stack
array
queue
Identify the best case time complexity of selection sort?
O(nlogn)
O(n^2)
O(n)
O(1)
What is the time complexity of the binary search algorithm?
O(log(2n))
O(n)
O(1)
O(n^2)
Algorithm can be represented as
Pseudocode
Flowchart
Flowchart & Pseudocode
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)
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
The operation of processing each element in the list is known as
Inserting
Traversal
Merging
Sorting
A graph in which all vertices have equal degree is known as __
Simple graph
Multi graph
Regular graph
Complete graph
Linked list are not suitable data structure of which one of the following problems ?
Insertion sort
Binary search
Polynomial manipulation
Radix sort
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)
Heap is an example of
binary search tree
spanning tree
sparse tree
complete binary tree
What’s happen if base condition is not defined in recursion
Stack underflow
Stack Overflow
None
Both overflow and underflow
Which Data Structure is used to perform Recursion
Queue
Stack
Linked List
Tree
If the size of the stack is 10 and we try to add the 11th element in the stack then the condition is known as___
Underflow
Garbage Collection
Overflow
None
Which one of the following is not the application of the stack data structure
String Reversal
Recursion
Backtracking
Asynchronous data transfer
Which data structure is mainly used for implementing the recursive algorithm?
Queue
Stack
Binary tree
Linked list
Which one of the following is not the type of the Queue?
Priority Queue
Circular Queue
Single Ended Queue
Double ended Queue
How many Queues are required to implement a Stack?
3
2
1
4
Which of the following is the time complexity to search an element in the linked list?
O(1)
O(n)
O(logn)
O(nlogn)
Which one of the following node is considered the top of the stack if the stack is implemented using the linked list?
First Node
Second Node
Last node
None
A list of elements in which enqueue operation takes place from one end, and dequeue operation takes place from one end is__
Binary tree
Stack
Queue
Linked list
Which one of the following is the overflow condition if linear queue is implemented using an array with a size MAX_SIZE?
rear = front
rear = front+1
rear=MAX_SIZE -1
rear = MAX_SIZE
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 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)
Which of the following statements is not true?
Quicksort and merge sort are both examples of divide and conquer algorithms.
If we randomly choose a pivot element each time, quicksort will always terminate in time O(n log n).
For every fixed strategy to choose a pivot for quicksort, we can construct a worst case input that requires time O(n2).
If we could find the median in time O(n), quicksort would have worst case complexity O(n log n).
Which is purely upper bound notation?
Big-oh
Small-oh
Big-omega
Theta
The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:
θ(n logn), θ(n logn),θ(n2)
θ(n2),θ(n2), θ(nlogn)
θ(n2), θ(n logn), θ(n logn)
θ(n2), θ(n logn),θ(n2)
Which one of the following correctly determines the solution of the recurrence relation with T(1) = 1?
T(1) = 2T (n/2) + log n
θ(n)
θ(n logn)
θ(n2)
θ(logn)
