Python Searching and Sorting


Searching is the process of finding some particular element in the list/records/array. If the element is present in the list, then the process is called successful and the process returns the location of that element, otherwise, the search is called unsuccessful.

There are two popular search methods that are widely used in order to search some items into the list. However, the choice of the algorithm depends upon the arrangement of the list.

* Linear Search
* Binary Search

Searching of an element is processed in two ways:

* Internal Searching
* External Searching

Internal searching

When all the records to be searched are kept in the main memory then such searching is termed as internal searching.

External searching

When the number of elements is more and all the elements cannot be stored in the main memory but are stored in a secondary memory/storage device. Then this kind of searching is termed external searching.

Internal searching External searching
Internal searching is done in internal memory. External searching is done in external memory
Internal searching is applied to a small collection of data/elements External searching applied to a huge collection of data/elements.
Internal searching does not make use of extra resources. External searching makes use of extra resources.
Internal searching requires primary memory such as RAM External searching requires external storage memory such as hard disk, floppy disk, etc.