Bags are a datastructure that allow you to: add(a), remove(a), iterate(), size(), and contains(a). They may contain duplicates and have no defined order or obligation to order.
I see them as a semantic.
This can be useful to emphasize that order does not matter when performing operations on your data. Examples (spellchecker words vs.. dictionary), mean, std dev, summation, etc. They can also be used to emphasize that the data cannot be meaningfully sorted. Examples might include vertices of an object in space(or positions of players in a game), data with no resolved meaning(such as input to a neural network, images/media with no meta-data, components on the screen), etc. There is also the case in which order can matter but control over said order should not be controled by the user of the bag. This could be useful if the list must always be sorted.
It should also be noted a bag can be implemented using arrays, dynamic arrays, linked lists, etc. It really doesn't matter.
http://web.engr.oregonstate.edu/~sinisa/...pter08.pdf
https://algs4.cs.princeton.edu/13stacks/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32