Complexity 
We discussed decidability problem in the last section to classify problems by whether they are solvable or not. However, in real world, we have limited resources to solve problems, therefore, we need to further classify decidable problems by the amount of resources (Time & Space) required to solve them. In this section, we will discuss the complexity of problems.
Time Complexity 
The running time of a Turing Machine 
where 
Worst Case Analysis
In analysis of the amount of resources, we always consider the worst case. The reason is that the worst case is the most important case in practice. If we can solve the worst case, we can solve all other cases.
Time Complexity Classes 
Big O Notation 
In practice, the exact number of steps is usually complicated to calculate. Therefore, we use the Big O Notation to simplify the analysis.
Definition of Big O Notation Given function 
Example
 is . is . is . is .
We can define time complexity classes based on Big O Notation. 
  
  
where
This means that 
Since all deterministic TMs are also non-deterministic TMs, we have 
- Hamiltonian Path Problem (We will show this later.)
 - Traveling Salesman Problem
 - Clique Problem
 
Polynomial Time Verifier 
We can also define 
Hamiltonian Path Problem
Given a graph 
This problem is apparently 
A polynomial verifier for a language 
The verifier 
If we have a polynomial time verifier for a language 
  
Each NTM can be simulated by a deterministic TM in exponential time. For a tree of 
