How Dynamic Arrays Actually Work: Resizing & Amortized O(1)