105k views
0 votes
What is the best data structure to solve the following problem? a) A list needs to be built dynamically. b) Data must be easy to find, preferably in O(1). c) The user does not care about any order statistics such as finding max or min or median. d) First assume that the index is given. e) Then assume that it is not given.

User Ayoy
by
5.4k points

1 Answer

2 votes

Data must be easy to find, preferably in O(1) is the best data structure to solve the following problem.

b) Data must be easy to find, preferably in O(1).

Step-by-step explanation:

The best data structure should covers, linked list, arrays, stack, queues, tree, graphics extra. Data structure stores the data either ascending order or descending order. Since it has linked list to store values.

If the data structure display starts will store or displayed from ascending order to ascending order, when it starts from left to right.

If the data structure display starts will store or displayed from descending order to descending order when it starts from right to left data value.

Searching the value in the data structure should be easy.

User Raymond Nijland
by
5.8k points