performing linear search on an array to find an element