Skip to content
Advertisement

Can data structure be structured by another data structure?

I’m a little bit confused. Wikipedia says that Array is a data structure:

In computer science, an array data structure, or simply an array, is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key.

Stack and queue are also data structures. Learn.js says that array can work with data structures such as stack and queue.

So, my question is… it turns out that data structure can also be structured with another data structure? Or, as far as I understand, array is a slightly different data structure, unlike stack and queue. The array structures its data by index, while stack and queue structure data by order of entry (FIFO / LIFO). And it turns out that different data structures by “type” can be structured by other data structures of a different “type”? … Or I misunderstood something …

Advertisement

Answer

“Data structure” is a very general idea, and data structures exist at different levels of abstraction.

So “array” and “object” are very basic data structures — an array is just a linear collection of data indexed numerically, while an object is a collection with named elements.

“Stack” and “queue” are higher level abstractions. They’re typically implemented using objects and arrays to hold the raw data, and they provide additional operations that reflect the way these abstractions are used.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement