Which data-structure operation is used to remove an existing element?

Options

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

Correct Answer (Detailed Explanation is Below)

B. Deletion

Detailed Explanation

Deletion removes an existing element from a data structure. Its implementation depends on the structure. For example, deleting an element from the middle of an array may require shifting subsequent elements, while deleting a node from a linked list can be efficient when the relevant node or previous node is already known. In a stack, deletion is called pop, while in a queue, deletion is normally called dequeue. Complexity depends on the structure and operation.