**Broad Overview :**

Complexity theory, in a nutshell, a complexity word is a quite fancy word, literally, it sounds complex, but it is not an intimidating topic. What it really means is analyzing the program or we can say analyzing the efficiency of the program, figuring out whether the program is correct, figuring out whether one program is better than the other program and how exactly do we go about doing it in a very quantified way. There are lots of variants of this bit that we are generally looking at when we are doing any computer programming or in general or in most practical purposes are just two main complexities, one is Time Complexity, and the other is Space (memory) Complexity.

Time complexity is simple as how fast your code runs, how much time it will take, depends on the number of steps. Time complexity is hardware-independent, so let suppose I write one program, and I might have a supercomputer or I might have a simple laptop, so the time will be different based on where you run the program so it is not a very deterministic metric and we want something very robust and pretty deterministic so next we have a very simple step, which does not measure the actual time but we know that the time is basically very proportional to the number of steps that are taken by the program.

**Example of Complexity in Time (execution) and Space (memory) factors :**

**Example-1 : More Complex**

i = 1; 1s while( i <= 10 ) 11s { a = 5; 10s result = i * a; 10s printf(“\n” /d”, result); 10s i++; 10s }

Here, we assume each variable is equal to **2 Bytes**. In the above example we use three variables (i, a, result) which is **6 Bytes.**

**Execution Time : **52s**Memory (Space) : **6 Bytes**Example-2 : Less Complex**

a = 5; 1s i = 1; 1s while( i<=10) 11s { result = i * a; 10s printf(“\n” /d”, result); 10s i++; 10s }

**Execution Time :** 43s**Memory (Space) :** 6 Bytes**Problems in Computation Complexity :**

**Solvable Problems :**

A problem is said to be solvable first either if you find a solution means what there exists a potential solution, you have an algorithm and procedure to find its solution but also the problem is solvable if you proved mathematically there exists no solution which means the problem does not require any further discussion because we know the problem can never be solvable n matter how many times, we try to solve the problem.**Unsolvable Problem :**

Unsolvable problems in computer science is a temporary status of the problem because a problem is unsolvable, we say that instant of time neither we are able to solve the problem nor in a position to say that the problem can not be solved which means in unsolvable problems we are still confused, and the discussion is still open. And if the problem lies in this domain so it is known as an unsolvable problem.**Decidable Vs Undecidable :**

Basically, the solvable problems are divided into two categories – Decidable and Undecidable. Before going into the depth of the decidability domain, we should have a good knowledge of algorithms and machine models of the Theory of Computation, especially the Turing Machines.**Decidable Problem :**

When we talk about the decidable problems the two important terms are used algorithms and procedures. The procedure is a step-by-step instruction to solve a problem. A procedure becomes an algorithm when we say what is the approximate time to solve a problem. When we are concern with decidable problems means it includes both algorithms as well as procedures.**Undecidable Problem :**

When we talk about undecidable problems then we can not predict the time of the problem in which a problem can be solved. Undecidable problems are also solvable and there exists a procedure to solve the problem, but the problem is complex as we cannot predict the approximate time.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.