Searching vs Sorting
Searching algorithms check elements or retrieve an element from a data structure.
Sorting algorithms arrange data in a specific format, the most common formats being numerical and lexicographical.
Some real-life examples of sorting are:
- Telephone directory
- Dictionary
| Searching | Sorting |
| It is used to retrieve elements from any data structure. | It is used to arrange the data of a list or an array in a particular order. |
| The time complexity is O(N). | The time complexity is O(N2). |
| We can classify it into two categories: sequential search and interval search. | We can classify it into two categories: internal sorting and external sorting. |
| Examples: Linear search and Binary search. | Examples: Bubble Sort, Insertion Sort, Selection Sort, Merge Sort, Quick Sort, etc. |
Reference
