Data Structure - Sorting Techniques - Data Structure & Algorithms

What is Data Structure Sorting?

Arranging the data in a particular format is known as Sorting. The way in which the data is arranged in a particular order is Algorithm sorting. Mostly the order in which the data is arranged is either numerical or lexicographical order.

The sorted data facilitates in optimizing the process of data searching. Also facilitates in representing the data in readable format. Real-life examples of sorting are:

  • Telephone Directory − The telephone directory stores the telephone numbers of people sorted by their names, so that the names can be searched easily.
  • Dictionary − The dictionary stores words in an alphabetical order so that searching of any word becomes easy.

What is Data Structure In-place Sorting and Not-in-place Sorting?

To sort an algorithm some extra space is required for comparison and temporary storage is required for few data elements, which do not need extra space for sorting, and is known as in-place sorting. Example of in-place sorting is Bubble sort.

In some algorithm sorting, space is required by the program. The space required is equivalent to that of the stored elements. Sorting that requires more or equal space of an element is known as not-in-place sorting. Example of no-in-space sorting is Merge-sort.

What is Data Structure Stable and Not Stable Sorting?

After the sorting of the contents, if the sequence of the sorting algorithm does not change and appear almost similar in which they originally appear is known as stable sorting.

Stable Sort

After the sorting of the contents, if the sequence of the sorting algorithm change and appear almost similar in which they originally appear is known as Not Stable Sorting.

Unstable Sort

When the sequence of the original elements is desired to maintain, then the stability of the algorithm matters.

What is Data Structure Adaptive and Non-Adaptive Sorting Algorithm?

If an algorithm has already the sorted elements in the list which is to be sorted, then the sorting algorithm is said to be adaptive. The adaptive algorithm takes into account that the source list has already sorted some element, and will not re-order them

A non-adaptive algorithm does not take into account the elements which are already sorted is tried to force every single element to be re-ordered to confirm their sortedness.

What re the important terms used in Data Structure Sorting?

Some of the terms which are used in the Data Structure Sorting technique are:

Increasing Order

If the successive element is greater than the previous one, the sequence of values is to be in Increasing Order. For instance, 1, 3, 4, 6, 8, 9 are in increasing order, as every next element is greater than the previous element.

Decreasing Order

If the successive element is less than the current one, the sequence of values is to be in Decreasing Order. For instance, 9, 8, 6, 4, 3, 1 are in decreasing order, as every next element is less than the current element.

Non-Increasing Order

If the successive element is less than or equal to its previous element in the sequence, then the sequence of values is said to be in Non-Increasing Order. This order occurs when the sequence contains duplicate values. For instance, 9, 8, 6, 3, 3, 1 are in non-increasing order, as every next element is less than or equal to (in case of 3) but not greater than any previous element.

Non-Decreasing Order

If the successive element is greater than or equal to its previous element in the sequence then the sequence of values is said to be in Non-Decreasing Order. This order occurs when the sequence contains duplicate values. For instance, 1, 3, 3, 6, 8, 9 are in non-decreasing order, as every next element is greater than or equal to (in case of 3) but not less than the previous one.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Data Structure & Algorithms Topics