I think it is O(n) in the worst situation