Which data-structure operation is used to add a new element?

Options

  • A. Deletion
  • B. Insertion
  • C. Traversal
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. Insertion

Detailed Explanation

Insertion is the operation used to add a new element to a data structure. The exact procedure depends on the structure. In an array, insertion may require shifting existing elements. In a linked list, a new node can be connected using pointers. In a stack, insertion is called push, while in a queue, insertion is normally called enqueue. The time complexity of insertion depends on the data structure and the position where the element is added.