Professional Documents
Culture Documents
University of Sargodha, Lahore Campus Final Term Examinations (Spring-2016)
University of Sargodha, Lahore Campus Final Term Examinations (Spring-2016)
Instructions:
Attempt all questions in this sheet. Over writing will be marked as incorrect.
There is zero tolerance towards PLAGARISM.
Question # 1:
Choose the correct options. (1.5*12=18 marks)
1. In quick sort, the number of partitions into which the file of size n is divided by a
selected record is
a) 2 b)N-1
c) N d)None of the above
2. Heap is defined to be a
a) Binary Tree b)Complete binary tree
3. Suppose we need to sort a list of employee records in ascending order, using ID as the
key. If we need to guarantee that the running time will be no longer worse than nlogn,
which sorting method could we use?
a) Merge sort b)Quick sort
c)Insertion sort d)Either merge sort or quick sort
4. In stable algorithm
a) One array is used b)Repeating elements are not handled
c) Repeating elements remain in the same relative position after sorting
d)More than one arrays are used
There are 5 items as follow:
5. The Knapsack can hold 60 pounds, find the solution, assuming it is 0/1:
a)
b) 250$ c) 260$
University of Sargodha, Lahore Campus
Final Term Examinations (Spring-2016)
d) 270$ e) 280$
6. The Knapsack can hold 60 pounds, find the solution, assuming it is fractional:
a) 250$ c) 270$
b) 260$ d) 280$
7. Consider the string ‘ABACDAACAC’ if the string is coded with ASCII codes using
Huffman encoding scheme, the message length would be?
10. The greedy part of the Huffman encoding algorithm is to first find two nodes with
……… frequency
a) Larger c) Balance
b) Smallest d) Character