Sunday, 11 September 2016

SORTING

SORTING:
                 Sorting is the process of arranging the elements in some logical order. This logical order may be ascending or descending in case of numeric value.

Sorting can be classified into following categories on the basis of where the data is sorted:
  1. Internal Sorting: An internal sort is any data sorting process that takes place entirely within the main memory of a computer. It is independent of time to read/write a record.
  2. External Sorting: External sorting uses secondary memory. It can take large input and deals with some sorting the data stored in data files. When the volume of data to be sort is very large and cannot be held in computer main memory, then external sorting is used.
Classification of Sorting techniques:

1.Sorting by insertion: The items are considered one at a time and each new item is inserted into the appropriate position relative to the previously sorted items. The technique which follows this category is insertion sort.

2.Sorting by exchanging: If two items are found to be out of order they are interchanged. This interchanging process is repeated until no more exchanges are necessary. The technique which follows this category are:
  • Shell sort
  • Bubble sort
  • Quick sort.
3.Sorting by selection: First the smallest (or largest) item is located and it is somehow separated from the rest then the next smallest (or next largest) is selected and so on. The techniques which follows this category are:
  • Selection sort
  • Heap sort.
4.Sorting by merging: Merging operation combines two or more ordered list into a single ordered list. The technique which follows this category is Merge Sort.

5.Sorting by distribution:  These methods were used to sort punched cards for many years before electronic computers existed. The distribution is based on the digit of the category is Bucket Sort (Radix Sort).

No comments:

Post a Comment

POLYMORPHISM IN C++

POLYMORPHISM IN C++ C++ achieves polymorphism through: i) Function overloading ii)Operator overloading By the...