Complete the sentence to describe the time complexity of accessing an element in an array by index.
Accessing an element by index in an array has a time complexity of O([1]).
Accessing an element by index in an array is done directly, so it takes constant time, O(1).
Complete the sentence to describe the time complexity of inserting an element at the end of a dynamic array (amortized).
Inserting an element at the end of a dynamic array has an amortized time complexity of O([1]).Appending to a dynamic array is usually O(1) amortized because resizing happens occasionally, but most inserts are constant time.
Fix the error in the statement about deleting an element from the middle of an array.
Deleting an element from the middle of an array has a time complexity of O([1]).
Deleting from the middle requires shifting all elements after it, which takes O(n) time.
Fill both blanks to describe the time complexities of searching for an element and inserting at the beginning of an array.
Searching for an element in an unsorted array takes O([1]), and inserting at the beginning takes O([2]).
Searching requires checking each element, so O(n). Inserting at the beginning requires shifting all elements, also O(n).
Fill all three blanks to complete the dictionary comprehension that maps array operations to their average time complexities.
complexities = {"access": O([1]), "append": O([2]), "delete_middle": O([3])}Access is O(1), append is O(1) amortized, and deleting from the middle is O(n) due to shifting.