Data structure - What is sequential search? What is the average number of comparisons in a sequential search?
What is sequential search? What is the average number of comparisons in a sequential search?Sequential search searches for elements in an array sequentially until the element is found. The average number of comparisons can be n+1/2. What is sequential search? What is the average number of comparisons in a sequential search?Sequential search: Searching an element in an array, the search starts from the first element till the last element.
The average number of comparisons in a sequential search is (N+1)/2 where N is the size of the array. If the element is in the 1st position, the number of comparisons will be 1 and if the element is in the last position, the number of comparisons will be N.
|
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?......