What is the time complexity of accessing an element at a specific index in a standard array?
Think about how arrays store elements in memory.
Arrays store elements in contiguous memory locations, so accessing any element by index takes constant time.
What is the time complexity of inserting an element at the start of a fixed-size array?
Consider what happens to existing elements when you insert at the start.
Inserting at the beginning requires shifting all existing elements one position to the right, which takes linear time.
Which deletion operation in an array has the lowest time complexity?
Think about how many elements need to be moved after deletion.
Deleting the last element is O(1) because no shifting is needed, while deleting elsewhere requires shifting elements.
Why does searching for a value in an unsorted array take linear time?
Think about how you find a value without any order.
Without sorting, you must check each element until you find the target or reach the end, which is linear time.
When repeatedly inserting elements at the end of a dynamic array that doubles its size when full, what is the average time complexity per insertion?
Consider how resizing affects insertion time over many operations.
Although resizing takes O(n), it happens rarely. Most insertions are O(1), so average (amortized) time is constant.