0% found this document useful (0 votes)
11 views

Comp 314 - 2017

Uploaded by

tinirol126
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Comp 314 - 2017

Uploaded by

tinirol126
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Mark Scored:

KATHMANDU UNIVERSITY
End Semester Examination
August/September, 2017
Level : B. E./B. Sc. Course : COMP 314
Year : III Semester : II
Exam Roll No. : Time: 30 min F. M. : 10

Registration No.: Date :


SECTION “A”
[20 Q × 0.5 = 10 marks]

Select the best answer among the given choices.

1. The elements of an array are stored successively in memory cells because:


a. by this way computer can keep track only the address of the first element and the
addresses of other elements can be calculated
b. the architecture of computer memory does not allow arrays to store other than serially
c. both of the above
d. None of the above

2. Each array declaration need not give, implicitly or explicitly, the information about:
a. The name of the array b. The data type of the array
c. The first data from the set to be stored d. The index set of the array

3. The operation of processing each element in the list is known as:


a. Sorting b. Merging c. Insertion d. Traversal

4. The indirect change of the values of a variable in one module by another module is
called:
a. Internal change b. Inter-module change
c. Side effect d. Side-module update

5. What is the worst-case time for a binary search finding a single item in an array?
a. Constant time b. Logarithmic time c. Linear time d. Quadratic time

6. Consider the following tree:

If the above tree is used for sorting, then a new number 8 should be placed as the:
a. Left child of the node labeled 30 b. Right child of the node labeled 5
c. Right child of the node labeled 30 d. Left child of the node labeled 10

7. Traversing a binary tree first root and then left and right subtrees is called:
a. Postorder traversal b. Preorder traversal
c. Inorder traversal d. Depth-First traversal
8. The condition Top = -1 indicates that:
a. Stack is empty b. Stack is full
c. Stack has only one element d. None of these

9. An algorithm must be generic enough to solve all problems of a particular class. Which
of the following relates to this property of algorithms?
a. Finiteness b. Definiteness c. Generality d. Effectiveness

10. A mathematical model with a collection of operations defined on that model is called:
a. Data structure b. Abstract Data Type
c. Primitive Data Type d. Algorithm

11. In case of a chained hash table of n elements with b buckets, assuming that a worst case
resulted in all the n elements getting mapped to the same bucket, then the worst case time
complexity of a search on the hash table would be given by:
a. O(1) b. O(n/b) c. O(n) d. O(b)

12. Find the odd one out:


a. O(n) b. O(n2) c. O(n3) d. O(3n)

13. A balanced binary tree is a binary tree in which the heights of the two subtrees of every
node never differ by more than:
a. 2 b. 1 c. 0 d. None of the above

14. The element at the root of a heap is :


a. largest
b. smallest
c. depending upon the type of the heap, it may be smallest or largest
d. None of the above.
15. Which of the following represents a cross edge?
a. (u, v) where u and v are not ancestors or descendents of one another.
b. (u, v) where v is a (not necessarily proper) ancestor of u in the tree.
c. (u, v) where v is a proper descendent of u in the tree.
d. None of the above
16. The running time of Prim’s algorithm is:
a. Ο((V+E)2 log V) b. Ο(V log V) c. Ο(E log V) d. Ο(V2)

17. The running time of Dijkstra’s algorithm is :


a. O(V2) b. O(E lg V) c. O(V+E) d. O(V.E)

18. In a heap with n elements and with the smallest elements at the root, the 7’th smallest
element can be found in:
a. Ө(n lg n) b. Ө(n) c. Ө( lg n) d. Ө(1)

19. A connected graph T without any cycles is called:


a. a tree graph b. a free tree c. a tree d. All of the above

20. Which of the following is not true of Flow networks?


a. Flow in is equal to Flow out in the vertices other than the source and the sink.
b. f(u,v) = - f(v,u)
c. f(u,v)<= c(u,v)
d. Capacity can have zero or negative values
KATHMANDU UNIVERSITY
End Semester Examination
August/September, 2017
Level : B. E./B. Sc. Course : COMP 314
Year : III Semester : II
Time : 2 hrs. 30 mins. F. M. : 40
SECTION “B”
[4 Q. × 5 =20 marks]
Answer ANY FOUR questions.

1. How does one measure the efficiency of algorithms? Distinguish between best, worst and
average case complexities of an algorithm.

2. Discuss insertion sort algorithm. Illustrate the working mechanism of insertion sort for
the given array input <31, 41, 59, 26, 41, 58>. What are the time complexities of
insertion sort in the best and the worst cases?

3. Compare and contrast “Divide and Conquer” algorithm design strategy with “Dynamic
Programming”. Provide examples where each of the methods are used.

4. Find the shortest path distances for each of the vertices in the graph provided below using
Dijkstra’s algorithm. Show the different steps involved in the process.

5. Explain “greedy” algorithms in the context of the Activity Scheduling Problem. What is
the greedy strategy employed in selecting the activities?

SECTION “C”
[2 Q. × 10 = 20 marks]
Attempt ANY TWO questions.

6. Explain Depth-First Search Traversal method and its working mechanism. Apply DFS in
the following topological sort problem. Show the final order of dressing. [5 + 5]
7. Write short notes on [2 × 5=10]
a) Backtracking algorithms and the 4 queen problem
b) Binary search tree and the operations on the search tree (querying and modification
operations)

8. Define Flow networks. State and explain the three properties of a flow. Compute the net
flow across and capacity of the cut (S,T), where S ={ s, v1, v2} and T = { v3, v4, t}. [5 + 5]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy