Sorting algorithms

What is Sorting?

arranging elements in a sequential manner is called sorting.there are three important reasons behind sorting of an elements

  • Time Complexity
  • Space Complexity
  • The efficiency of Linear Search

Time Complexity

The number of machine instructions, which a program executes during its run time is called its “time complexity”. This number depends primarily on the size of the program’s input. Time taken by a program is the sum of the compile-time and runtime. In the time complexity, we consider run time only

Space Complexity

the space complexity is most important for low-end computers, the space complexity of an algorithm (for a given input) is the number of elementary objects that this algorithm needs to store during its execution. This number computed with respect to the size of the input data. The space occupied by an algorithm is determined by the number and sizes of the variables and data structures used by the algorithm.

efficiency of Linear Search

Linear search works with an efficiency of O(N) for N number of elements in the list. If the data are distributed randomly, an average of N/2comparison is needed. The worst case is that the value is not there in the list or it is the last element, which takes n comparisons to search

Last updated on by vishal devxo