Sunday, November 2, 2014

Sorting Algorithms

A sorting algorithm puts elements in a list to a certain order.

After sorting the output is a permutation of the input and the output is in nondecreasing order(must not be in increasing order, it may contain same items)

*Partitioning

*Merging

*Selection

*Insertion

*Exchanging

Partitioning is choosing a pivot element and placing elements with values less than the pivot to left and elements with greater values to right.

Merging is dividing the list to 1 unit elements so it is ordered and then merging until there is only one list

Selection generate another list then select from there

Insertion slide all by one to insert in the needed place

Exchanging copy to temp then change the values.

No comments: