9 Lecture
CS502
Midterm & Final Term Short Notes
Complexity Theory
Complexity theory is the study of the computational resources required to solve problems. It provides a framework for analyzing the efficiency of algorithms and classifying problems based on their difficulty. Complexity theory seeks to understan
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is the time complexity of binary search algorithm? a. O(1) b. O(log n) c. O(n) d. O(n^2) Answer: b. O(log n) What is the space complexity of bubble sort algorithm? a. O(1) b. O(n) c. O(n^2) d. O(log n) Answer: a. O(1) Which complexity class does the problem of factoring large integers belong to? a. P b. NP c. NP-hard d. NP-complete Answer: d. NP-complete Which complexity class does the problem of finding the shortest path in a graph belong to? a. P b. NP c. NP-hard d. NP-complete Answer: a. P What is the worst-case time complexity of the brute-force algorithm for the traveling salesman problem? a. O(n!) b. O(2^n) c. O(n^2) d. O(log n) Answer: a. O(n!) Which of the following is not a complexity class? a. PSPACE b. PTIME c. EXP d. NPSPACE Answer: d. NPSPACE What is the time complexity of the merge sort algorithm? a. O(1) b. O(n) c. O(n log n) d. O(n^2) Answer: c. O(n log n) Which of the following is an example of a decision problem? a. Sorting a list of integers b. Finding the shortest path in a graph c. Determining whether a number is prime d. Factoring a large integer Answer: c. Determining whether a number is prime Which of the following complexity classes is believed to be strictly larger than P? a. NP b. PSPACE c. EXP d. NP-complete Answer: c. EXP What is the time complexity of the naive algorithm for matrix multiplication? a. O(1) b. O(n) c. O(n^2) d. O(n^3) Answer: d. O(n^3)
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is the difference between time complexity and space complexity? Answer: Time complexity measures the amount of time taken by an algorithm to solve a problem, whereas space complexity measures the amount of memory used by an algorithm to solve a problem. What is the significance of the class P in complexity theory? Answer: The class P contains all decision problems that can be solved in polynomial time. This class is important because many important problems in computer science, such as sorting and searching, are known to belong to P. What is the meaning of the term "hardness" in complexity theory? Answer: The term "hardness" is used to describe the difficulty of a problem. A problem is said to be hard if it is unlikely to have an efficient algorithmic solution. What is the difference between the classes NP and NP-complete? Answer: The class NP contains all decision problems that can be verified in polynomial time. The class NP-complete contains all problems that are at least as hard as the hardest problems in NP. What is the significance of the class NP-hard in complexity theory? Answer: The class NP-hard contains all problems that are at least as hard as the hardest problems in NP. These problems are important because they are believed to be very difficult, and many of them are used as benchmarks for the performance of algorithms. What is the significance of the class PSPACE in complexity theory? Answer: The class PSPACE contains all decision problems that can be solved using polynomial space. This class is important because it contains many important problems, such as the problem of determining whether a chess position is a win, loss, or draw. What is the significance of the class EXP in complexity theory? Answer: The class EXP contains all decision problems that can be solved using exponential time. This class is important because it contains many problems that are believed to be very difficult, such as the problem of factoring large integers. What is the meaning of the term "reduction" in complexity theory? Answer: The term "reduction" refers to the process of transforming one problem into another problem. Reductions are used to show that one problem is at least as hard as another problem. What is the difference between a decision problem and an optimization problem? Answer: A decision problem asks whether a certain condition holds, whereas an optimization problem asks for the best solution to a certain condition. In other words, a decision problem is a yes-or-no question, whereas an optimization problem is a question of finding the best answer. What is the significance of the traveling salesman problem in complexity theory? Answer: The traveling salesman problem is a well-known problem in complexity theory that asks for the shortest possible route that visits each of a given set of cities and returns to the starting city. It is significant because it is an example of an NP-complete problem, which is believed to be very difficult.