# Sorting in Data Structure

## Basics and Time Complexities of all Sorting Algorithms

### A sorting algorithm is an algorithm made up of a series of instructions that takes an array as input, performs specified operations on the array, sometimes called a list, and outputs a sorted array.

### Sorting algorithms are often taught early in computer science classes as they provide a straightforward way to introduce other key computer science topics like Big-O notation, divide-and-conquer methods, and data structures such as binary trees, and heaps. There are many factors to consider when choosing a sorting algorithm to use.

###

Following is a quick revision sheet that you may refer at last minute.

#### Calculating Time Complexity

Now lets tap onto the next big topic related to Time complexity, which is How to Calculate Time Complexity. It becomes very confusing some times, but we will try to explain it in the simplest way.

Now the most common metric for calculating time complexity is

**Big O notation.**This removes all constant factors so that the running time can be estimated in relation to**N**, as N approaches infinity.#### Types of Notations for Time Complexity :

Now we will discuss and understand the various notations used for Time Complexity.

**Big Oh**denotes "*fewer than or the same as*" <expression> iterations.**Big Omega**denotes "*more than or the same as*" <expression> iterations.**Big Theta**denotes "*the same as*" <expression> iterations.**Little Oh**denotes "*fewer than*" <expression> iterations.**Little Omega**denotes "*more than*" <expression> iterations.

#### Understanding Notations of Time Complexity :

**O(expression)**is the set of functions that grow slower than or at the same rate as expression.

**Theta(expression)**consist of all the functions that lie in both O(expression) and Omega(expression).

**Omega(expression)**is the set of functions that grow faster than or at the same rate as expression.

#### Sorting Efficiency

There are many techniques for sorting. Implementation of particular sorting technique depends upon situation. Sorting techniques mainly depends on two parameters. First parameter is the execution time of program, which means time taken for execution of program. Second is the space, which means space taken by the program.

#### Types of Sorting :

There are many types of Sorting techniques, differentiated by their efficiency and space requirements. Following are some sorting techniques which we will be covering in next sections.

**Bubble Sort****Insertion Sort****Selection Sort****Quick Sort****Merge Sort****Heap Sort**

**Soon, I will upload the programs as well as its description to under Sorting concept in detail.**

**Please, Share your feedback and reviews about this blogs in the comment section below.**

**Thank You and Stay Active for more updates.**