2
$\begingroup$

From abstract data types in wiki, I'm reading about two types: collection and container. Can anyone supply a better detailed difference between the difference between the two? https://en.wikipedia.org/wiki/Container_(abstract_data_type) https://en.wikipedia.org/wiki/Collection_(abstract_data_type)

As I understand...

Collection is an abstract data type.

  • it is a grouping of some variable number of data items. Collections can be further specialized into Linear Collections, Associative Collections, and Graph Collection.
  • "Collection does not prescribe a specific implementation as a concrete data structure, though often there is a conventional choice (see Container ) "

Container is an abstract data type.

  • they store objects in an organized way that follows specific access rules.
  • seem to have more explicit properties/methods i.e CRUD operators, etc.

From what it looks like, Collection is definitely more abstract compared to containers. Collection seem to define a general relation on the insides of how data are related to each other in order/or lack there of. The container ADT is also very similar, but I'm guessing container is just a slightly more detail abstraction for defining what essential operations is needed so that almost all lower more specific ADT can be implemented using containers.

side note: "Collection does not prescribe a specific implementation as a concrete data structure, though often there is a conventional choice (see Container ) " - then what is not a conventional choice?

$\endgroup$
2
  • $\begingroup$ In my understanding, a container is the supporting data structure and the collection is the set of contained elements. They are equally "abstract" concepts. $\endgroup$
    – user16034
    Nov 29, 2022 at 7:55
  • $\begingroup$ @YvesDaoust thx ! but what does it mean as a supporting data structure? $\endgroup$
    – cozycoder
    Nov 29, 2022 at 15:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.