Searching Algorithms
Searching in data structure refers to the process of finding location LOC of an element in a list. Searching Techniques There are tow types of searching in data structure and analysis Linear Search Binary Search.
This is the simplest method for searching technique. In this technique of searching, the element to be found in searching the elements to be found is searched sequentially from list. This method can be performed on a sorted or an unsorted list mostly arrays. In case of a sorted list searching starts from 0th element and continues until the element is found from the list or the element whose value is greater than the value being searched is reached.
Binary search is a very fast and efficient searching technique compared to previous one. It requires the list to be in sorted order. In this method, to search an element you can compare it with the present element at the center of list. If it matches, then the search is successful otherwise the list is divided into two sub list: one from the 0th element to the middle element which is the center element another from the center element to the last element where all values are greater than the center element.
Comments
Post a Comment