6/19/14

Sorting.

Data can be sorted.

Sorting is a problem quite often solved by computers & programmers.

Sorted data sets are much more useful usually, than unsorted data sets.

Sorted data sets are easier to search for information, among other qualities they possess.

There can be various criteria by which we can sort data.

There are various sorting algorithms, with different algorithmic speeds and other costs, for different data structures, and for different data.


---

Why certain sorting algorithms are better for certain data? Because the more we know about data processed, the more we can take advantage of that information.

For example: if we know that part of the data is already sorted, and if we know which part is unsorted, then we can sort just unsorted part of it, instead of going through the whole data set.

For example: if we know that data has such a structure that after '2' numbers there are '3' numbers, we can incorporate this into sorting algorithm, properly.

if it's a set of integer numbers, this can be used like that:

- we categorize numbers into smaller than '2', '2', '3', larger than '3',
- then we can proceed, taking ('2','3') pairs from data to be sorted, sorting them properly,
- then we can sort remaining sets (smaller than '2', larger than '3'),
- then we can merge partial results of sorting operation into a 'whole sorted data set'.

with proper data structures (ones that let us add & remove data from 'data sets' efficiently), this is a quite fast sorting algorithm for our data, but it's worse for data with other, different qualities.

---

For details, see: [4], [19], perhaps more.

See also: Basic Data Structures.

No comments:

Post a Comment