Recursive and non-recursive sorting algorithms

Can someone explain in English how non-recursive and recursive implementations of sorting algorithms differ from each other?

+4
source share
3 answers

Recursive sorting algorithms work by breaking an input into two or more smaller inputs, then sorting them and then combining the results. Merge sort and quick sort are examples of recursive sorting algorithms.

A non-recursive method is one that does not use recursion. Insertion sort is a simple example of a non-recursive sorting algorithm.

+2
source

How do they differ in what sense? Keep in mind: any recursive algorithm can be implemented as an iterative algorithm, and vice versa (look at this post ). An iteration or recursion is just an implementation detail; although this can have a big impact on performance depending on the choice, the algorithm will be the same.

+6
source

The recursive sorting algorithm causes itself to sort a smaller part of the array, and then combine the partially sorted results. An example of quick sorting.

A non-recursive algorithm sorts immediately without calling itself. Bubble-sort is an example of a non-recursive algorithm.

0
source

All Articles