Data Structure Time Complexity Question #15243
Single Choice Easy

QWhat is the time complexity of inserting an element at the beginning of a dynamic array?

ID: #15243 Time Complexity 149 views
Question Info
#15243Q ID
EasyDifficulty
Time ComplexityTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A O(n)
  • B O(1)
  • C O(log n)
  • D O(n log n)
Correct Answer

Explanation

Inserting an element at the beginning of a dynamic array requires shifting all existing elements one position to the right to make room for the new element. Since the number of elements in the array affects the number of shifts required, the time complexity of this operation is linear, denoted as O(n).

Share This Question

Challenge a friend or share with your study group.