Algorithmic implementation of linear search