# Algorithms and Time Complexity

Algorithms and Time Complexity

Name

Institution

Algorithms and Time Complexity

Time complexity in algorithms is what quantifies the time taken by an algorithm to be executed as a function of the command representing the input. It is commonly expressed using the big O notation. This notation includes coefficients and lower order terms. When expressed in this manner, the time complexity is termed to be described asymptotically.

The space complexity is a computational resource describing the resource of memory space available for a deterministic turing machine. It is used to represent the amount of memory space that a physical computer would require to be able to solve a specific computational problem with a given algorithm.

A polynomial time algorithm runs in polynomial time p() and the time taken by the algorithm to solve every instance of the problem is upper bounded by p and the polynomial evaluated at the size of the input while a non-deterministic polynomial (NP) time algorithm is a class where a problem H is NP-hard where every problem L in NP could be reduced in polynomial time to H. class NP contains all problems that can be solved in polynomial time.

Examples of worst case run times include insertion sort and quicksort. In insertion sort, we apply this to a list of n elements under the assumption that they are all different and initially in random order. Therefore the algorithm compares to the j+1-st element to be inserted on the average while the sorted sub-list, so tj = j/2. Consequently, the quicksort algorithm will be O(log(n))

## Leave a Reply