linear_search function with lambda for comparison