Data structure - What is binary searching and Fibonacci search?
What is binary searching and Fibonacci search?Binary search is used to find an element of a sorted list only. For the element to be searched, the middle value is first compared. If it is same as the element to be sought, the search stops. Else, the same mechanism of search is performed on the left or right side elements of the middle elements depending on whether the sought value is greater than or less than the middle element.
Fibonacci search:- Fibonacci search is used to search an element of a sorted array with the help of Fibonacci numbers. It studies the locations whose addresses have lower dispersion. Fibonacci number is subtracted from the index thereby reducing the size of the list.What is binary searching and Fibonacci search?Binary Search: Binary search is the process of locating an element in a sorted list. The search starts by dividing the list into two parts. The algorithm compares the median value. If the search element is less than the median value, the top list only will be searched, after finding the middle element of that list. The process continues until the element is found or the search in the top list is completed. The same process is continued for the bottom list, until the element is found or the search in the bottom list is completed. If an element is found that must be the median value.
Fibonacci Search: Fibonacci search is a process of searching a sorted array by utilizing divide and conquer algorithm. Fibonacci search examines locations whose addresses have lower dispersion. When the search element has non-uniform access memory storage, the Fibonacci search algorithm reduces the average time needed for accessing a storage location.
|
Advanced embedded systems interview questions and answersAdvanced embedded systems interview questions and answers - What is read modify write technique?, In which addressing mode is the DPTR register used?, Which registers are used for register indirect addressing mode if data is on-chip?......