package Searches; import java.util.Random; import java.util.stream.Stream; /** * Linear search is the easiest search algorithm It works with sorted and unsorted arrays (an binary * search works only with sorted array) This algorithm just compares all elements of an array to * find a value * *
Worst-case performance O(n) Best-case performance O(1) Average performance O(n) Worst-case
* space complexity
*
* @author Varun Upadhyay (https://github.com/varunu28)
* @author Podshivalov Nikita (https://github.com/nikitap492)
* @see BinarySearch
* @see SearchAlgorithm
*/
public class LinearSearch implements SearchAlgorithm {
/**
* Generic Linear search method
*
* @param array List to be searched
* @param value Key being searched for
* @return Location of the key
*/
@Override
public