80 likes | 592 Views
Sorting and Searching. Chapter 2 (16M). Visit for more Learning Resources. Sorting:. It is a Process by which a collection of items are placed into ascending order or in descending order.
E N D
Sorting and Searching Chapter 2 (16M) Visit for more Learning Resources
Sorting: • It is a Process by which a collection of items are placed into ascending order or in descending order. • Sorting is the operation of arranging data or elements in some given order, numerically or alphabetically. • The sorting is classified into two categories. 1. Internal Sorting: 2. External Sorting:
Internal Sorting: • In this sorting technique, all the data is stored in main memory only . • The data can be accessed randomly. • Access of data will extremely fast. • This method is used when data items are less. • Example. • Bubble Sort • Insertion Sort • Selection Sort • Quick Sort
2. External Sorting • In this sorting, the data to be sorted is moved from secondary storage to main memory. • It is more time consuming to move records into different location. • This method is used when data items are larged. • Access of data element is slow. • Examples: • K-way Merging, Balanced Merge Sort
Sorting Stability A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input unsorted array. Some sorting algorithms are stable by nature like Insertion sort, Merge Sort, Bubble Sort, etc. And some sorting algorithms are not, like Heap Sort, Quick Sort, etc.
Sorting Techniques: • Sorting Techniques: • Bubble Sort • Insertion Sort • Selection Sort • Quick Sort • Merge Sort • Radix Sort • Shell Sort For more detail contact us