Analysis of Algorithms and Computational Complexity Questions and Answers
Understanding the Analysis of Algorithms and Computational Complexity questions with answers is crucial for students preparing for GATE, TCS, Infosys, and Wipro placement exams. This topic focuses on evaluating the efficiency of algorithms based on time and space complexity, which forms the foundation of advanced computer programming and system design. By solving programming questions and answers related to algorithm analysis, you can strengthen your logical thinking, optimize code performance, and make informed design decisions. In this section, we cover detailed MCQs and explanations to help you master Big O notation, asymptotic analysis, and algorithmic trade-offs. Perfect for both academic and placement preparation, this guide ensures clarity with well-explained examples.
Questions on algorithmic analysis for computer science aspirants can be complemented by data structure algorithms and software engineering MCQ
Analysis of Algorithms and Computational Complexity
211. A text is made up of the characters a, b, c, d, e each occurring with the probability 0.12, 0.4, 0.15, 0.08, and .25 respectively. The optional coding technique will have the average length of
- 4.78
- 3.78
- 2.78
- 1.78
212. The order of an algorithm that finds whether a given boolean function of 'n' variables, produces a 1 is
- constant
- linear
- logarithmic
- exponential
213. The best sorting methods if number of swappings done, is the only measure of efficiency is
- Bubble sort
- Selection sort
- Insertion sort
- Quick sort
214. The maximum number of comparisons needed to sort 7 items using radix sort is (assume each item is a 4 digit decimal number)
- 280
- 40
- 47
- 38
215. As part of the maintenance work, you are entrusted with the work of rearranging the library books in a shelf in proper order, at the end of each day. The ideal choice will be
- bubble sort
- insertion sort
- selection sort
- heap sort
216. Which of the following algorithms exhibits the unnatural behaviour that, minimum number of comparisons are needed if the list to be sorted is in the reverse order and maximum number of comparisons are needed if they are already in order?
- Heap sort
- Radix sort
- Binary insertion sort
- None of these
217. The sorting method which sorts a given set of items that is already in order or in reverse order with equal speed is
- Heap sort
- Quick sort
- Insertion sort
- Selection sort
218. Algorithm which solves the all-pair shortest path problem is
- Dijkstra's algorithm
- Floyd's algorithm
- Prim's algorithm
- Warshall's algorithm
219. Stack A has the entries a, b, c (with a on top). Stack B is empty. an entry propped out of stack A can be printed immediately or pushed to stack B. An entry popped out of the stack B can only be printed. IN this arrangement, which of the following permutations of a, b, c are not possible?
- b a c
- b c a
- c a b
- a b c
220. In the previous problem, if the stack A has 4 entries, then the number of possible permutations will be
- 24
- 12
- 21
- 14