Home Page class 12 @ Python

CBSE Class 12 : Data Structures

Introduction to Data Structures

CBSE Class 12 : Searching

Creation And Traversal
What is Searching?
Linear/Sequential Search
Binary Search
Insertion Of Element
Deletion Of Element

CBSE Class 12 : Sorting

What is sorting?
Bubble Sort
Selection Sort
Insertion Sort

CBSE Class 12 : Stacks

Applications of Stacks
Implementation of Stacks

CBSE Class 12 : Queues

Applications Of Queues
Implementation of Queues

Class 12: Data Structures Sorting


Sorting is the operation of arranging the records of a table/list/array in a particular order, either in ascending or descending order.

While sorting we must take care of special case, when two or more records/elements/nodes have same key values then it is important to preserve the order of the elements/records/nodes.

A sorting algorithm is said to be stable if it preserves the order of the elements with duplicate values.

Internal sorting

If all the records to be sorted are kept internally in the main memory while sorting then the sort is said to be internal sort.

External sort

If there are large numbers of elements to be sorted then while sorting process all the elements cannot be kept in the main memory but are stored in the secondary storage device, this kind of sorting is termed as external sorting.

Difference between internal and external sorting

Internal sorting External sorting
Internal sorting is done in internal memory External sorting in done in external memory
Internal sorting is applied to a smaller collection of data External sorting is applied to huge collection of data.
Internal sorting does not make use of extra resources. External sorting makes use of extra resources.
Internal sorting requires primary memory such as RAM. External sorting requires primary memory such as floppy disk , hard disk, etc.
Example: insertion sort , quick sort. Example: merge sort.