You are on page 1of 4

C Data Structures 1. What is the time complexity of linear search algorithm over an array of n ele ments? a. O (log2 n) b.

O (n) (ans) c. O (n log2 n) d. O (n2) 2. What is the time taken by binary search algorithm to search a key in a sorted array of n elements. a. O(log2 n) (ans) b. O(n) c. O(n log2 n) d. O(n2) 3. What is the time required to search an element in a linked list of length n ? a. O(log2 n) b. O(n) (ans) c. O(n log2 n) d. O(n2) 4. What is the worst case time required to search a given element in a sorted li st of length n ? a. O(log2 n) b. O(n log2 n) c. O(n) (ans) d. O(1) 5. Consider a linked list of n elements which is pointed by an external pointer. What is the time taken to delete the element which is successor of the element pointed to by a given pointer ? a O(1). (ans) b. O(log2 n) c. O(n) d. O(n log2 n) 6. Which of the following operations is performed more efficiently by doubly lin ked list than by linear linked list? a Deleting a node whose location is given. (ans) b. Searching an unsorted list for a given item. c. Inserting a node after the node with a given location. d. Traversing the list to process each node. 7. s? a. b. c. d. 8. a. b. c. d. Which data structure is needed to convert infix notations to postfix notation Linear list Queue. Tree. Stack. (ans) Recursive procedures are implemented by Queue Stacks. (ans) Lined lists. Strings.

9. A linear list of elements in which deletion can be done from one end(front) and insertion can take place only at the other end (rear) is known as

a. b. c. d.

Queue (ans) Stacks. Trees. Deque.

10. Consider the lined list implementation of a queue with two pointers : front and rear. What is the time needed to insert element in a queue of length n ? a O(1). (ans) b. O(log2 n) c. O(n) d. O(n log2 n) 11. A linear list in which elements can be added or removed at either end but n ot in the middle, is known as a. Queue. b. Deque. c. Trees. d. Deque. 15. What is the time required to insert an element in a stack with linked implem entation. a O(1). (ans) b. O(log2 n) c. O(n) d. O(n log2 n) 16. A binary tree in which of the levels except possibly the last, have the maxi mum number of nodes and all the nodes at the last level appear as far leaf as po ssible, is known as a. Full binary tree. b. 2-tree c. Threaded tree. d. Complete binary tree.(ans) 18. A list of integers are read in, one at a time and a binary search tree is co nstructed, Next the tree is traversed and the integers are printed. Which traver sed would result in a printout which duplicates the original order of the list i ntergers ? a. Preorder. b. Postorder. c. Inorder. d. None of the above. (ans) 19. The five iterms A,B,C,D and E are pushed rting from A. The stack is popped four times ueue. Then two elements are deleted from the Now one item is popped from the stack . The a. A b. B c. C d. D in a stack, one after the other sta and each element in inserted in a q queue and pushed back on the stack. popped item is

20. The time required to search an element in a binary search tree having n elem ents is a O(1). b. O(log2 n) (ans) c. O(n) d. O(n log2 n) 20. Consider that n elements are to be sorted. What is the worst case time compl

exity of bubble sort ? a O(1). b. O(n log2 n) c. O(n1.2) d. O(n2) (ans) 21. What is the worst case time complexity of straight insertion sort algorithm to sort n elements ? a O(n). b. O(n log2 n) c. O(n1.2) (ans) d. O(n2) 23. What is the worst case time complexity of binary insertion sort algorithm t o sort n elements ? a O(n). b. O(n log2 n) 0000 c. O(n1.2) d. O(n2) (ans) 24. If each node in a tree has value greater than every value in its left subtre e and has value less than every value in its right subtree, the tree is known as a. b. c. d. Completer tree. Full binary tree Binary search tree (ans) Threaded tree

25. Which of the following sorting procedure is the slowest ? a. Quick tree b. Heap sort c. Shell sort d. Bubble sort (ans) 26. The infix expression (A+(B-C)*D) is correctly represented in prefix notation as a. A+B-C*D b. +A*-BCD c. ABC-D*+ d. A+BC-D* 40. In what tree, for every node the height of its left subtree and right subtre e differ atleast by one ? a. Binary search tree. b. AVL tree. (ans) c. Complete tree. d. Threaded binary tree. 41. Which of the following sorting method is stable. a. Stright insertion sort. (ans) b. Binary insertion sort. c. Shell sort. d. Heap sort. 42. A complete binary tree with the property that the value of each node is atle ast as large as the values at its children is known as a. Binary search tree. b. AVL tree c. Complete balanced tree.

d. Heap. (ans) 45. The goal of hashing is to produce a search that takes a O(1). Time (ans) b.. O(n2) time c. O( log n) time c. O(nlog n) time 46. In which of the following sorting algorithm, the number of comparisons need ed is the minimum if the items are initially in reverse order and is the maximum if the items are in oreder ? a. straight insertion sort. b. Binary insertion sort. (ans) c. Heap sort. d. Bubble sort.

You might also like