There are a number of sorting techniques that can be employed to sort a given list of data elements.the suitability of a specific techniques in the specific situation depends on a number of factors,such as
Solution:
(a)Array A sorted in ascending order.
- Size of the data structure.
- Algorithm efficiency.
- Programmer's knowledge of the technique.
Sorting techniques:
- Consider a list L containing 'n' elements,as shown
- Now there are n! ways in which the elements can be arranged within the list.we can apply a sorting technique to the list L to arrange the elements in either ascending or descending order.
- If we sort the list in ascending order,then
- Alternatively,if we arrange the list in descending order,then
- A telephone directory is one such example where both sorting and searching technique are applied.
Consider an array A containing 5 elements,as shown below
Solution:
(a)Array A sorted in ascending order.
(b)Array A sorted in descending order.
The number of Sorting methods are given below:
(1)Insertion sort
(2)Selection sort
(3)Shell sort
(4)Bubble sort
(5)Quick sort
(6)Merge sort
(7)Radix sort
- All sorting techniques which require the data set to be present in the main memory are referred as internal sorting techniques.
No comments:
Post a Comment