Searching is the procedure of looking for something: Finding one piece of data that has been stored inside a whole group of data. It is frequently the most time-consuming part of many computer programs. There are many methods, or algorithms, used to search for data item, based on how much data there is to look through, what kind of data it is, what type of structure the data is stored in, and even where the data is stored - inside computer memory or on some external medium.
Till now, we have studied a variety of data structures, their types, and their use and so on. In this unit, we will concentrate on some techniques to search a particular data or piece of information from a large amount of data. There are fundamentally two kinds of searching techniques, Sequential or Linear Search and Binary Search.
Searching is very common task in day-to-day life, where we are involved some or other time, in searching either for some needful at home or office or market, or searching a word in dictionary. We see that if the things are organized in some manner, then search becomes efficient and fast in this unit.
All the above facts apply to our computer programs also. Imagine we have a telephone directory stored in the memory in an array that contains Name & Numbers. Now, what happens if we have to find a number? The answer is searching that number in the array according to name (given). If the names were organized in some order, searching would have been fast.
Thus, basically a search algorithm is an algorithm which accepts an argument 'a' and tries to find the corresponding data where the match of 'a' occurs in a file or in a table.
After going through this unit, you should be able to:
- know about the basic concepts of searching;
- know about the process of performing the Linear Search;
- know about the procedure of performing the Binary Search and
- know about the different applications of searching