Font size
WorksheetsDesign and Analysis of Algorithms [5th Sem BCA]
Total questions: 45
Worksheet time: 23mins
An algorithm is a set of __________ followed to complete a task.
values
points
scores
instructions
O(n)
O(m)
O(n+m)
O(n*m)
If for an algorithm time complexity is given by O(1) then complexityof it is:
constant
polynomial
exponential
none of the mentioned
What is the time complexity of this algorithm?
O(n)
O(2n)
O(log n)
O(n2)
O(1)
Find the slowest algorithm:
O (n)
O (n^2)
O (n!)
O (2^n)
Which of the following is not an alogrithm design technique?
Greedy
Integer Programming
Dynamic Programming
Divide and Conquer
What is the worst case time complexity of Quick sort?
O(lg n)
O (n lg n)
O (n2)
O (n)
Which of the following is not a shortest path finding algorithm?
Dijkstra's Algorithm
Bellman-Ford Algorithm
Floyd-Warshall Algorithm
Kruskal's Algorithm
The no.of passes in selection sort to sort n numbers is .....?
n
n-1
n^2
logn
Which of the following standard algorithms is not Dynamic Programming based.
Bellman–Ford Algorithm for single source shortest path
Floyd Warshall Algorithm for all pairs shortest paths
0-1 Knapsack problem
Prim's Minimum Spanning Tree
We use dynamic programming approach when
We need an optimal solution
The solution has optimal substructure
The given problem can be reduced to the 3-SAT problem
It's faster than Greedy
Which of the following standard algorithms is not a Greedy algorithm?
Dijkstra's shortest path algorithm
Prim's algorithm
Huffman Coding
Bellmen Ford Shortest path algorithm
The difference between Divide and Conquer and Dynamic Programming is:
The division of problems and combination of subproblems
Whether the sub problems overlap or not
The way we solve the base case
The depth of recurrence
Which of the following problems is NOT solved using dynamic programming?
0/1 knapsack problem
Matrix chain multiplication problem
Edit distance problem
Fractional knapsack problem
The complexity of Binary search algorithm is
O(n)
O(log n)
O(n2)
O(n log n)
The number of executions grows extremely quickly as the size of the input increases
Exponential Time
Linear Time
Polynomial Time
Constant Time
asymptotic notations represents
space complexity of algo
time complexity of algo
both a and b
none of the above
Big
Ω defineslower bound
upper bound
middle bound
none of the above
Which one of the following uses divide, conquer and combine approach?
Quick Sort
Merge Sort
Selection
Counting Sort
What is the space complexity of Bubble sort?
O(n)
O(nlog2n)
O(1)
O(n2)
You are given a knapsack that can carry a maximum weight of 60. There are 4 items with weights {20, 30, 40, 70} and values {70, 80, 90, 200}. What is the maximum value of the items you can carry using the knapsack?
170
200
160
90
Which of the following problems is NOT solved using dynamic programming?
0/1 knapsack problem
Matrix chain multiplication problem
Edit distance problem
Fractional knapsack problem
Input Parameters: array a, start index p, end index r.
Output Parameter: array a sorted.
{ if (p > r)m = (p + r) / 2 Mergesort (a, p, m) Mergesort (a, m + 1, r) Merge (a, p, m, r) }
{ if (p < r) m = (p + r) / 2 Mergesort (a, p, m) Mergesort (a, m + 1, r) Merge (a, p, m, r) }
{ if (p = r)m = (p + r) / 2 Mergesort (a, p, m) Mergesort (a, m + 1, r) Merge (a, p, m, r) }
What is the shortest path from node A to node F?
A -> B -> D -> F
A -> C -> B -> E -> F
A -> F
A -> C -> E -> F
What are some common techniques to improve time efficiency in algorithms?
Using outdated data structures, implementing outdated algorithms, increasing unnecessary computations or iterations, and optimizing code poorly
Using random data structures, implementing random algorithms, increasing unnecessary computations or iterations, and optimizing code randomly
Using inefficient data structures, implementing inefficient algorithms, increasing unnecessary computations or iterations, and optimizing code poorly
Using efficient data structures, implementing efficient algorithms, reducing unnecessary computations or iterations, and optimizing code
What are some common techniques to improve space efficiency in algorithms?
Using data structures that require less memory, implementing in-place operations, applying dynamic programming techniques, utilizing compression algorithms
Using data structures that require more memory, avoiding in-place operations, ignoring dynamic programming techniques, not utilizing compression algorithms
In travelling salesman problem, we are interested in finding
shortest path from one source to multiple destinations
A salesman is expected to start from one source and by visiting all locations he/she should come back to the source in minimum time
longest available path in the graph
A Salesman is expected to complete the task in given deadline
What is the other name of Dijkstra algorithm?
single-source shortest path problem
multiple-source shortest path problem
multiple-destination shortest path problem
single-destination shortest path problem
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:
Divide and Conquer
Dynamic Programming
Greedy Algorithm
Branch and Bound
An Algorithm Must contain
output
Input
User Instruction
Lines
Shapes
What is Pseudocode
A semiformal, English-like language with limited vocabulary that can be used to design and describe algorithms.
A formal language that is specifically used to write program.
A graph used to depict or show a step by step solution using symbols which represent a task.
A series of steps or statements that are executed in the order they are written in an algorithm.
Which type of sort algorithm is this?
Bubble
Merge
Insertion
Decomposition is a term used to define...
The process of assigning value to a variable.
The process of taking out unnecessary details from problems.
The process of breaking down problems into smaller problems.
The process of coding a problem.
Priori analysis is the theoretical analysis of an algorithm that is done before implementing the algorithm.
True
False
The same algorithm can be represented in different ways
True
False
What is the time complexity of this algorithm?
O(n)
O(2n)
O(log n)
O(n2)
O(1)
