Question

In a dynamic array (such as Python's list or Java's ArrayList) that doubles its capacity whenever it becomes full, what is the amortized time complexity of a single append operation?

A O(n), since every single append must always trigger a full underlying array copy
B O(log n), since the doubling strategy inherently mirrors a binary search process
C O(n^2), since resizing repeatedly compounds the cost of all prior append operations
D O(1), since the occasional expensive resize is spread evenly across many cheap appends
E O(1) worst case, since resizing never actually happens once initial capacity is set
Practice Next

Hey! Ask a query

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)