add O(n) method