Have to admit it, after a few (will not say how many) years studying Computer Science, architecting and developing systems in multiple programming languages and platforms I had missed the Bag algorithm :o( Gladly I am spending time reading and performing several (do not have time to work on all) exercises and examples in the Algorithms fourth edition book by Robert Sedgewick and Kevin Wayne.
The Bag algorithm is used to implement an object that stores in no particular order items added to it. There is an Application Programming Interface (API) to get the size of the bag and to determine if it is empty. If an Iterator is implemented, then a client is able to iterate in no particular order through the items in a bag. Continue reading “Bag Algorithm”