We saw how to match the two given strings last time and determine whether they first of them is less than, greater than or equal to the second string. We developed a simple string matching algorithm for that purpose. Similarly we also want to perform a number of other operations on our strings and need to find certain patterns and keys in them. Today we shall develop a simple character finding algorithm in a given string. Let us see which things we need to find out.
Posts Tagged ‘searching’
Linear search, as described last time is ineffective for method for finding piece of information, the key from a large list. If you have a database of one hundred thousand people living in Los Angeles, you would surely have a headache if you were to look at each and every element of that database to look for your key. In such situations, Binary Search comes into play. Binary search is a very efficient searching algorithm especially for large amount of data. For binary search to perform, data in the list has to be sorted beforehand.
We search for different sort of things in our daily life. This search process is so common and typical that we do not realize how actually search is being performed. And that how the required key is brought out from the depth of information of the massive databases. In computer science, there are many methods for searching a key inside a list. Just like various sorting techniques, there are many searching algorithms as well. A basic and primitive searching method is to look at every element of the list and match the required information. This is known as Linear Search. I shall explain to you what linear search in essence is.