| You may have missed the class on optimizations – that's where Bags and Sets were discussed, as well as how OrderedCollections are like/unlike arrays. Bags and Sets are WAY better than OrderedCollections – for some tasks. You might want to learn what Sets and Bags are before the final. And yes, you are expected to know how OrderedCollections work internally, since it was in the lecture. Mark Guzdial |
| The notes on optimization are in the Extras folder on the CD – I suggest looking at them. Webb's (c) is close, but misses a couple key points. For example, do you know by how much a Squeak OrderedCollection (or a Java Vector – it's identical code, actually!) grows when it has to grow? For (a) and (b), think about operations with data structures: Insertions, deletions, searching for an element, asking if an element exists, etc. For which of these are bags and sets a couple orders of magnitude faster than arrays? And why? (Hint: There is at least one.) Mark Guzdial |
| Two additions to these great replies. First, Dictionary's can use anything as keys, not just strings. Second, there is a difference between OrderedCollection's and Arrays, even when the OrderedCollection isn't growing. Can anyone describe that difference? -Lex Spoon |
| I believe sets are collections that only contain one copy of each object. So if you tried to add another object it wouldnt let you actually it would let you but it wouldnt actually add the object. So if you wanted to build a collection of objects without duplicates you would use a set. Anyone object? Arkady |