Ordered Bag

An OrderedBag is a DataStructure which combines, in many ways, the properties of both sets and lists. It operates as follows:

All sets are also valid OrderedBags. All lists are also ordered bags, assuming the same key (or a null key) is assigned to each element of the list.

This seems like a combination of map and bag and list. It is confusing.


My personal opinion - to me an "ordered bag" is simply a essentially a list, and it is confusing to describe it as otherwise. A set is a collection where every element must be distinct. A bag is a collection which permits indistinct elements, i.e. an identical element E may occur with say 3 occurrences. Both of these are unordered (unless specified otherwise). Now an ordered bag has (1) non-uniqueness of elements (2) an ordering of elements? How is this different from a list? Thus I say that a list and an ordered bag are the same thing. The definition given above, does not make much sense to me. -- ZacharyMartin


What practical use is there in having an order for identical keys but not different keys? If we have a surrogate key for identical keys, we might as well use the same mechanism for all keys rather than create condition-based look-up logic. If there is any detectable order to the keys, which is usually the case, then it's essentially a list anyhow because unique keys are have an inherit order (themselves collated) and the "ordered" duplicate keys also create a detectable order by definition.


See


It seems that this was an offshoot from something called BagDiscussion in 2005, so whoever invented this page is probably not around here now to read this. That does not invalidate any present comments, but means there may not be a response. -- JohnFletcher


CategoryDataStructure


EditText of this page (last edited November 23, 2011) or FindPage with title or text search