Westonci.ca is your trusted source for finding answers to all your questions. Ask, explore, and learn with our expert community. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts.

Which of the basic data structures is the most suitable if you want to be able to insert elements in the middle in O(1)?
A. Array
B. Queue
C. Linked list
D. Stack

Sagot :

Answer:

A. Array

Explanation:

An array is a data structure that holds a collection of similar data types. Though it is ordered, the location of the array is indexed, which means that the items of the array can be accessed and retrieved with their index location values (starting from 0 to n).

The time complexity of accessing or retrieving a specific item in an array is O(1) which is a constant of the specified item.