Sort

Sorting is one of the most common applications in computer science. The process through which data are arranged in either ascending or descending order according to their values. Sorts are generally classified as either internal or external:

  • Internal sort -All of data are held in primary storage during the sorting process.
  • External sort- Uses primary storage for the data currently being sorted and secondary data for any data that will not fit in primary memory.
In choosing Sorting techniques there are few factors you should consider which are:
  • Number of item and load
  • Number of characters in item or record
  • Average case 
  • Best case
  • Worst case
  • Sorter stabilization especially for sorter that use 2 keys

Sorting Method

There are many sorting techniques, and every technique can be categorized according to their method group.Here is the method:
  1. Priority Queue Sorting Method
    • An array A is divided into sub-array P represents priority queue and sub-array Q represents output queue.
    • The idea is to find the largest key among unsorted key in P and place it at the end of queue of Q. This will result a sorted queue Q in increasing order.
    • Example of sorting techniques use this method are selection sort and heap sort.
  2. Insert And Keep Method
    • This method is done by inserting key from an unsorted array A into an empty holder C, doing the sorting as they are inserted. Thus, each keys in A that is entered, is placed in its correct sorted position in C from start.
    • Example of sorting techniques use this method are insertion sort and tree sort.
  3. Divide and Conquer Method
    • This method partition the unsorted list A into 2 sub-lists, L and R. The 2 sub lists are then sorted recursively. The sorted lists then combined into 1 list in such a way so that the combined list is sorted.
    • Example of sorting techniques use this method are quick sort and merge sort.
  4. Diminishing Increment Sort Method
    • Example of sorting technique use this method is Shell Sort.


Comments

Popular posts from this blog

Reading and Writing Operation of SRAM

Reading & Writing Operation of DRAM

Method to Convert from Stream to Json C#