Now it's time to define sorting formally,
Sorting
Sorting is a technique of arranging the elements in a list or collection in increasing or decreasing order of some property. The list should be homogenous to that means all the elements should be of the same data type. (To study sorting algorithms most of the time we use a list of integers)
For example:
4, 1, 6, 5, 9
1, 4, 5, 6, 9 (sorting in increasing order)
9, 6, 5, 4, 1 (sorting in decreasing order)
Complex type examples of sorting:
hotel sorting by price
online shopping sites for product sorting (by price, brand, color, etc...)
General Definition of sorting algorithms:
Some of the sorting algorithms that are mostly used are:
Bubble sort
Selection sort
Merge sort
Quick sort
Heap sort
Radix sort
Insertion sort
Counting sort
Classification of sorting algorithms
1) Time Complexity
2) Space Complexity
- In place, constant memory
- memory usage grows with input size
3) Stability
4) Internal sort or External Sort
5) Recursive or Non-recursive
The above Article is contributed by kunal Bandale. To contribute an article just click here
Usefull
ReplyDeleteGreat kunal proud of u bro
ReplyDelete