I'd count it as M(unique, n + 1) = 1 + max(M(remove, n), M(unique, n - number of duplicates of current element)) which can be majored by M(unique, n + 1) = 1 + max(M(remove, n), M(unique, n)) remove is I'd assume O(n), so that'd make M(n + 1) = 1 + max(O(n), M(n)) which I think is O(n) (where M(function, n) is the memory used by function for a list of length n)