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
  1. 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
  1. 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.

Complexity theory is a field of computer science that studies the inherent difficulty of computational problems. It seeks to classify problems according to their computational complexity, and to develop algorithms that can efficiently solve them. The primary measure of computational complexity is time, or the amount of computational resources required to solve a problem. Space, or the amount of memory required, is also considered. The most important classes of problems in complexity theory are P, NP, and NP-complete. P represents the class of problems that can be solved in polynomial time, which is to say that the time required to solve the problem grows no faster than a polynomial function of the input size. NP represents the class of decision problems that can be verified in polynomial time. NP-complete problems are the hardest problems in NP, and are believed to be inherently difficult to solve. The concept of NP-completeness is central to complexity theory, as it provides a means of classifying the difficulty of computational problems. A problem is NP-complete if it can be reduced to any other NP-complete problem in polynomial time. This means that if one could find an efficient algorithm for an NP-complete problem, then all NP-complete problems could be solved efficiently. One of the most famous problems in complexity theory is the P vs. NP problem, which asks whether P = NP. If P = NP, then it is possible to efficiently solve all problems in NP, including the NP-complete problems. However, if P ? NP, then there exist problems that are inherently difficult to solve. Other important classes of problems in complexity theory include PSPACE, which represents the class of problems that can be solved using polynomial space, and EXP, which represents the class of problems that can be solved using exponential time. Complexity theory has many practical applications, particularly in the field of algorithm design. The development of efficient algorithms is crucial in many areas of computer science and engineering, including cryptography, optimization, and artificial intelligence. Complexity theory also has important implications for the study of mathematical logic and theoretical computer science.