implement deleteAll in O(N)