Sorting is rearranging a set of data into a specific order such as ascending to descending for numbers, or vice versa. A sorting algorithm takes in a given array or list and outputs a sorted array or list.

Sorting is applied everywhere. When we are on a website and sorting listings by lowest price to highest, ratings, etc. or searching for a book at the library. The concept of sorting makes it easier to arrange sets of data, therefore making it easier to search.

Types of Sorting Algorithms

There are many types of sorting algorithms. Sorting techniques are mainly differentiated by time complexity and space complexity. As the name implies, time complexity is the amount of time an algorithm takes to run as a function of the input length and space complexity is the amount of space or memory required as a function of input length. Below lists a a few different types of sorting algorithms:

  • Quick sort
  • Bubble sort
  • Merge sort
  • Insertion sort
  • Heap sort

#recursion #javascript #computer-science #problem-solving #algorithms

Merge Sort Algorithm in Javascript
1.80 GEEK