Data Structure Time Complexity Question #15244
Single Choice Easy

QWhat is the time complexity of appending an element to the end of a dynamic array, assuming sufficient capacity is available?

ID: #15244 Time Complexity 152 views
Question Info
#15244Q 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

When appending an element to the end of a dynamic array with sufficient capacity, the operation can be performed in constant time. This is because the dynamic array allocates extra space to accommodate additional elements, and appending a new element simply requires placing it at the next available index. The time complexity of this operation is constant, denoted as O(1).

Share This Question

Challenge a friend or share with your study group.