Sorting - I'm Programmer
Want create site? Find Free WordPress Themes and plugins.

Let’s know about different sorting algorithm:

What is Sorting?

Sorting is an algorithm that arranges the elements of a list in a certain order like descending or ascending. And the output of the sorting will be permutation or reordering of the input.

Classification of Sorting Algorithms

  • By number of comparisons
  • By number of swaps
  • By number of usages
  • By recursion
  • By stability
  • By adaptability

Other Classifications:

  • Internal Sort – This type of the sorting main memory exclusively during the sort are called internal sorting algorithms. [ High-speed random access to all memory. ]
  • External Sort – This type of the sorting algorithms use external memory like tape or disk.

Most Popular Sorting algorithms:

  • Selection Sort
  • Bubble Sort
  • Insertion Sort
  • Shell Sort
  • Quick Sort
    • Simple quick sort
    • 3-way quick sort
    • Dual pivot quick sort
  • Merge Sort
    • Bottom-up merge sort
    • Top-down merge sort
  • Heap Sort
  • Tree Sort
  • Linear Sorting Algorithms
    • Counting Sort
    • Bucket Sort
    • Radix Sort
    • Topological Sort

Let’s see the time complexity of the each algorithm:

Time Complexity of Sorting Algorithms
Time Complexity of Sorting Algorithms

Let’s see all the sorting algorithms of different programming languages like for C, C++, Java, and Python.

  • C programming language:
    • qsort() is a polymorphic sorting algorithm for arrays of arbitrary objects. It is also called as “quicker sort” algorithm (a variant of quick sort algorithm).
  • C++ programming language:
    • sort() is using intro sort algorithm. It is a hybrid version of quick, heap and insertion
    • stable_sort() is using merge sort algorithm.
  • Java Programming language:
    • SE6 version – Arrays.sort()
      • It is using MergeSort for Objects types of element.
      • It is using Dual-Pivot Quicksort for primitive types of element.
    • SE7, SE8 & SE9 version – Arrays.sort()
      • It is using TimeSort for Objects types of element. This is the combination of hybrid of Mergesort and Insertion Sort.
      • It is using Dual-Pivot Quicksort for primitive types of element.
    • Collections.sort() – is using merge sort.
  • Python programming language:
    • sort() – it is using TimSort algorithm.
    • sorted() – it is also using TimSort algorithm.
  • Php programming language:
    • sort() – it is using quick sort algorithm. The pivot is chosen in the middle of the partition.

In above feature image, Quick Sort will win as below

quick-sort
quick-sort
Did you find apk for android? You can find new Free Android Games and apps.