Chapter: Programming and Data Structures - Sorting And Searching

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail

Sorting

Sorting is one of the most important operations performed by computers. In the days of magnetic tape storage before modern data-bases, it was almost certainly the most common operation performed by computers as most "database" updating was done by sorting transactions and merging them with a master file.

SORTING AND SEARCHING

 

1.       Bubble sort

2.       Quick sort

3.       Insertion sort

4.       Selection sort

5.       Shell sort

6.       Merge sort

7.       Radix sort

8.       Linear search

9.       Binary Search

10.  Hashing

 

Sorting

 

Definition:

 

Sorting: process by which a collection of items is placed into order

·        Operation of arranging data

·        Order typically based on a data field called a key

May be done to facilitate some other operation

Searching for elements

Sorting is one of the most important operations performed by computers. In the days of magnetic tape storage before modern data-bases, it was almost certainly the most common operation performed by computers as most "database" updating was done by sorting transactions and merging them with a master file. It's still important for presentation of data extracted from databases:

 

In general sorting consists of comparisons and swapping. All Sorting algorithms are categorized into Stable and unstable Sorting.

·        Stable Sorting:  If the sorting taken place inside the given input array.

·        Unstable Sorting: This kind of sorting needs a temporary array. This means sorting takes place outside of the array.

Next two categories of sorting are Internal sorting and External sorting. If the sorting takes place in internal main memory then it is internal sorting. If sorting happens in external memory storage such as magnetic tapes, Hard disk then it is external sorting.

 

The various sorting algorithms are available here some of them are discussed. They are as follows,

 

i)                   Exchange Sorts.

 

a)     Bubble sort

b)    Quick Sort

 

ii)                Selection sorts

a)     Straight selection sort

iii)Insertion sorts

a) Simple insertion sort

b) Shell sort

 

iv)              Merge and Radix Sorts

a)     Merge sort

 

b)    Radix sort

 

Exchange Sorts

 

The  second  class  of  sorting  algorithm  that  we  consider  comprises  algorithms  that     sort  by

 

exchanging pairs of items until the sequence is sorted. In general, an algorithm may exchange adjacent elements as well as widely separated ones.

 

Two types of exchange sorting procedures are Bubble sort and Merge sort.

 

 


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.