best O(n), worst O(n^2)