added methods to find min and max elements in a array