Sorting and Searching - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Random Posts

Sorting and Searching

Share This

Telephone directories are sorted alphabetically by last name. Why? Because a sorted index can be searched quickly. Even in the telephone directory of a huge city, one can usually find a name in a few seconds. In an unsorted index, nobody would even try to find a name.
There are thousands of examples, where items are to be sorted based on some logic. For example: 
  1. we have a list of students which is to be sorted based on name/roll no etc. 
  2. a list of jobs to be sorted based on their execution time, 
  3. a group of customers to be sorted based on their age. etc.

There are different sorting techniques, which will be discussed in brief.

In developing most of the software, we have to work with data that are to be kept in some data structure. To reduce access time, these data have to be stored in a sorted way. Based on the application area a suitable sorting technique needs to be applied. Moreover, if these data are not sorted we need linear time to search an item. If the data are sorted, we need much lesser time (logarithmic) to search an item. The techniques will be discussed in following tutorials.



Happy Exploring!

No comments:

Post a Comment