filmov
tv
Linear Search implementation in Java
Показать описание
Linear search or sequential search is a method for finding a particular value , that consists of checking every one of its elements, one at a time and in sequence, until the desired one is found.
simplest search algorithm.
For n items, the best case is when the value is equal to the first element of the list, in which case only one comparison is needed.
The worst case is when the value is not in the list (or occurs only once at the end of the list), in which case n comparisons are needed.
Linear searches don't require the collection or array to be sorted
This video explains this in java Programming
simplest search algorithm.
For n items, the best case is when the value is equal to the first element of the list, in which case only one comparison is needed.
The worst case is when the value is not in the list (or occurs only once at the end of the list), in which case n comparisons are needed.
Linear searches don't require the collection or array to be sorted
This video explains this in java Programming