Sei sulla pagina 1di 5

1Which of the following standard algorithms is not a Greedy algorithm?

A Dijkstra's shortest path algorithm


B Prim's algorithm
C Kruskal algorithm
D Huffman Coding
D

job sequencing with deadline is based on ____________method

a. greedy method
b. branch and bound C
c. dynamic programming
d. d. divide and conquer ans

fractional knapsack is based on ____________method

a. greedy method

c. branch and bound

b. dynamic programming

d. divide and conquer

0/1 knapsack is based on ____________method

a. greedy method

c. branch and bound

b. dynamic programming

d. divide and conquer

ans. Dynamic programming


The files x1,x2,x3 are 3 files of length 30,20,10 records each. What is the optimal merge pattern
value?

a. 110

c. 60

b. 90

d. 50

Ans. B

Dijkstra algorithm is also called the …………………. shortest path problem.


multiple source
single source
single destination
multiple destination

In Greedy method we get ________ Feasible solutions


one
more than one
zero
hundred

The output of Kruskal and Prims algorithm is ________________


Maximum spanning tree
Spanning tree
Minimum spanning tree
None
How do you determine the cost of a spanning tree?
By the sum of costs of the edges of the tree
By the sum of the costs of the edges and vertices of the tree
By the sum of the costs of the vertices of the tree
By the sum of costs of the edges of the graph

Which is optimal value in the case of job sequence problem Item : 1 2 3 4 5..
Profit : 20 15 10 5 1
Deadline : 2 2 3 3 3
1,3,4
1,2,4
4,2,3
1,5,2
B

How many edge are there in MCST generated from graph with 'n' vertices
n-1
n/2 - 1
n-2
n/2
a

Which is true statement in the following?


a. Kruskal’salgorithm is multiple source technique for finding MST.
b. Kruskal’s algorithm is used to find minimum spanning tree of a graph, time complexity of
this algorithm is O(EV)
c. Both of above
d. Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best Tree edge)
when the graph has relatively few edges )
D

Which of the following algorithms solves the all-pair shortest path problem?

a. Floyd's alg

b. Prim's algo

c. Dijkstra's

d. Warshall's

Answer:F

Worst case is the worst case time complexity of Prim’s algorithm if adjacency matrix is used?
a) O(log V)
2
b) O(V )
2
c) O(E )
d) O(V log E)
B
Which of the following is false about Prim’s algorithm?
a) It is a greedy algorithm
b) It constructs MST by selecting edges in increasing order of their weights
c) It never accepts cycles in the MST
d) It can be implemented using the Fibonacci heap
B’
What is the time complexity of Kruskal’s algorithm?
a) O(log V)
b) O(E log V)
2
c) O(E )
d) O(V log E)
B
 Which of the following is false about the Kruskal’s algorithm?
a) It is a greedy algorithm
b) It constructs MST by selecting edges in increasing order of their weights
c) It can accept cycles in the MST
d) It uses union-find data structure
C
What is the time complexity of Dijikstra’s algorithm?
a) O(N)
3
b) O(N )
2
c) O(N )
d) O(logN)
C
Dijkstra’s Algorithm cannot be applied on ______________
a) Directed and weighted graphs
b) Graphs having negative weight function
c) Unweighted graphs
d) Undirected and unweighted graphs
B
Bellmann ford algorithm provides solution for ____________ problems.
a) All pair shortest path
b) Sorting
c) Network flow
d) Single source shortest path
D
. Fractional knapsack problem is also known as __________
a) 0/1 knapsack problem
b) Continuous knapsack problem
c) Divisible knapsack problem
d) Non continuous knapsack problem
B
What is the objective of the knapsack problem?
a) To get maximum total value in the knapsack
b) To get minimum total value in the knapsack
c) To get maximum weight in the knapsack
d) To get minimum weight in the knapsack

Which of the following statement about 0/1 knapsack and fractional knapsack problem is
correct?
a) In 0/1 knapsack problem items are divisible and in fractional knapsack items are indivisible
b) Both are the same
c) 0/1 knapsack is solved using a greedy algorithm and fractional knapsack is solved using
dynamic programming
d) In 0/1 knapsack problem items are indivisible and in fractional knapsack items are divisible

Given items as {value,weight} pairs {{40,20},{30,10},{20,5}}. The capacity of knapsack=20. Find


the maximum value output assuming items to be divisible.
a) 60
b) 80
c) 100
d) 40

Potrebbero piacerti anche