Sorting refers to the operation of arranging data in some order such as increasing or decreasing with numerical data or alphabetically with character data

The complexity of a sorting algorithm measures the running time as a function of the number on n of items to be sorted .

External sorts

Complexity of Sorting Algorithm

Each
sorting algorithm S
will be made up of the following operations, where A1,
A2
, ……, An
contain the items to be sorted and B is an
auxiliary location:

(a)
Comparisons : which test whether Ai
< Aj or test Ai <
B

(b) Interchange,
which switch the content of Ai
and Aj or of Ai and B

#### Algorithms are divided into two categories:

Internal Sorts

and

#### Internal Sort:

Any
sort algorithm which uses main memory exclusively during the sort.

This
assumes high-speed random access to all memory.

#### External Sort:

Any
sort algorithm which uses external memory, such as tape or disk, during the
sort.

Note:

Algorithms
may read the initial values from magnetic tape or write sorted values to disk,
but this is
not using external memory during the sort. Note that even
though virtual memory may mask the use of disk, sorting sets of data much larger than main memory may be much faster
using an explicit external sort.

#### Sort Stable

A
sort algorithm is said to be “stable”
if multiple items which compare as equal will stay in the same order they were in after a sort.

### Type of sorting : (internal sorting ) :

**(click link to see algoritham to use )**

- Bubble Sort : concept-algorithm c code
- Quick Sort :concept-algorithm ,quick-sort c code
- Insertion Sort : concept-algorithm
- Selection Sort : selection-sort-concept :selection-sort-c program
- Merge Sort : merge-sort concept + c program
- Heap sort

## No comments:

## Post a Comment

THANKS FOR UR GREAT COMMENT