Question

Consider a code flow where a large dataset is stored in an array. If frequent insertions and deletions are required at arbitrary positions within the array, what is the typical time complexity impact?

A O(1) for both insertion and deletion
B O(log n) for both insertion and deletion
C O(n) for both insertion and deletion
D O(n log n) for insertion, O(n) for deletion
E O(1) for insertion, O(n) for deletion
Practice Next

Hey! Ask a query