Modified reallocate() to take a new capacity parameter
Added clear() function to clear the list