updated version of dynamic array with remove and pop implemented with capacity shrink
test the running time of append op on a list is O(1) in amortization