Ce 373 2
Ce 373 2
Answer all questions in Section A (Circle your answers) and any other two in Section B
1. What is the value of the postfix expression 6 3 2 4 + – *:
a. Something between -5 and -15 c. Something between -5 and 15
b. Something between -5 and -5 d. Something between 15 and 100
2. What is the worst-case run-time complexity of binary search algorithm?
a. Ο(n2) c. Ο(n3)
b. Ο(nlog n) d. On
3. Which of the following uses FIFO method?
a. Queue c. Hash Table
b. Stack d. Binary Search Tree
4. Two main measures for the efficiency of an algorithm are
a. Processor and memory c. Time and space
b. Complexity and capacity d. Data and Space
5. Which one of the below is not divide and conquer approach?
a. Insertion Sort c. Shell Sort
b. Merge Sort d. Heap Sort
6. Prefix notation is also known as
a. Reverse Polish Notation c. Polish Reverse Notation
b. Reverse Notation d. Polish Notation
7. In order traversal of binary search tree will produce
a. Unsorted list c. Sorted list
b. Reverse of input d. None of the above
8. Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm
to convert the expression from infix to postfix notation. The maximum number of symbols that
will appear on the stack AT ONE TIME during the conversion of this expression?
a. 1 c. 3
b. 2 d. 4
Page 1 of 4
9. Entries in a stack are “ordered”. What is the meaning of this statement?
a. A collection of stacks is sortable c. The entries are stored in a linked
list
b. Stack entries may be compared
with the ‘<‘ operation d. There is a Sequential entry that is
one by one
10. For a binary search algorithm to work, it is necessary that the array list must be
a. Sorted c. in a heap
b. Unsorted d. Popped out of stack
11. The time factor when determining the efficiency of algorithm is measured by
a. Counting microseconds c. Counting the number of
statements
b. Counting the number of key
operations d. Counting the kilobytes of
algorithm
12. Queue data structure works on
a. LIFO c. FILO
b. FIFO d. None of the above
13. Maximum number of nodes in a binary tree with height k, where root is height 0, is
a. 2k – 1 c. 2k-1 + 1
b. 2k+1 − 1 d. 2k − 1
14. Which of the following case does not exist in complexity theory
a. Best Case c. Average Case
b. Worst Base d. Null Case
15. What data structure is used for depth first
traversal of a graph?
c. List
a. Queue
d. None of the above
b. Stack
16. Which of the following data structure is not linear data structure?
a. Arrays c. Both of the above
b. Linked Lists d. None of the above
17. What data structure can be used to check if a syntax has balanced parenthesis ?
a. Queue c. List
b. Tree d. Stack
18. Postfix expression is just a reverse of prefix expression
a. True
b. False
Page 2 of 4
19. Which of the following data structure is linear data structure?
a. Trees c. Arrays
b. Graphs d. All of the above
20. A circular linked list can be used for
a. Stack c. Both Stack & Queue
b. Queue d. Neither Stack or Queue
21. A linked-list is a dynamic structure
a. True
b. False
22. Minimum number of moves required to solve a Tower of Hanoi puzzle is
a. 2 c. 2n - 1
2n
d. 2n - 1
b. 2n-1
23. Arrays are best data structures
a. for relatively permanent collections of c. for both of above situation
data
d. for none of above situation
b. for the size of the structure and the data
in the structure are constantly changing
24. The following formula will produce Fn = Fn-1 + Fn-2
a. Armstrong Number c. Euler Number
b. Fibonacci Series d. Prime Number
25. Minimum number of queues required for priority queue implementation?
a. 5 c. 3
b. 4 d. 2
26. Linked lists are best suited
a. for relatively permanent collections of c. for both of above situation
data
d. for none of above situation
b. for the size of the structure and the data
in the structure are constantly changing
27. Queue data structure works on
a. LIFO c. FILO
b. FIFO d. None of the above
28. What are the Approaches to Search?
a. Sequential and list methods (lists, c. Direct access by key value (hashing)
tables, arrays)
d. All of the above
b. Tree indexing methods
Page 3 of 4
29. The Θ notation in asymptotic evaluation represents
a. Base case c. Worst case
b. Average case d. NULL case
30. A balance factor in AVL tree is used to check
a. What rotation to make c. When the last rotation occurred
b. If all child nodes are at same level d. If the tree is unbalanced
SECTION B
3a. What are the basic operations needed to Sort an array of numbers?
b. Let comps(n) be the number of comparisons performed by the algorithm when
sorting an array of n components. Assume that step 1.1 performs n−1
comparisons. Write down equations defining comps(n) when n ≤ 1 and when n >1:
(i) in the best case, and (ii) in the worst case.
Write down the time complexity of the quick-sort algorithm: (i) in the best case,
and (ii) in the worst case.
When does the best case arise? When does the worst case arise?).
c. Using Horner’s Method, Compute the Hash Function of VERYLONGKEY
Page 4 of 4