Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "What does amortized O(1) append mean for a geometrically growing dynamic array?" on CodeWiki (https://codewiki.com/practice/mcq/foundations/arrays-and-linked-lists/amortized-array-append/).
Context (verbatim from the page):
"""
What does amortized O(1) append mean for a geometrically growing dynamic array?
Every append performs exactly one assignment.
Average cost over a long operation sequence is constant, although one resize may copy O(n) elements.
The array never allocates more storage.
The worst single append is O(1).
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in CS foundations. Where you are unsure, say so.