Discover answers to your questions with Westonci.ca, the leading Q&A platform that connects you with knowledgeable experts. Explore thousands of questions and answers from knowledgeable experts in various fields on our Q&A platform. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.

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.