Introduction to Sorting
Sorting is the act of storing data in a sorted order, which can be ascending or descending. With the term Searching, the concept Sorting comes into play. There are numerous things in our daily lives that we need to search for, such as a certain record in a database, roll numbers in a merit list, a specific phone number, a specific page in a book, and so on.
Sorting puts data in a logical order, making it easier to find what you're looking for. There will be one key for each record that will be sorted. The record will be ordered based on the key. Let's say we have a student database; each record will contain the following information:- Roll No.
- Name
- Age
- Class
In this case, the student roll number can be used as a sorting key to sort the records in ascending or descending order. If we need to find a student with the number 15, we won't have to look through the entire record; instead, we'll look at the Students with the numbers 10 to 20.
Sorting is the act of storing data in a sorted order, which can be ascending or descending. With the term Searching, the concept Sorting comes into play. There are numerous things in our daily lives that we need to search for, such as a certain record in a database, roll numbers in a merit list, a specific phone number, a specific page in a book, and so on.
Sorting puts data in a logical order, making it easier to find what you're looking for. There will be one key for each record that will be sorted. The record will be ordered based on the key. Let's say we have a student database; each record will contain the following information: