Should we revise the specification of the method containsso that if it locatesa given entry within the bag, it returns the index of that entry?
What will be an ideal response?
No. As a public method, containsshould not provide a client with such implementation details. The client should have no expectation that a bag’s entries are in an array, since they are in no particular order.
You might also like to view...
Changing the theme colors changes the overall design of the presentation.
a. true b. false
Answer the following statements true (T) or false (F)
1. It is usually much easier to process a large number of items in an array than to process a large number of items that are stored in separate variables. 2. The number of elements in an array is the value of the subscript of the last element in that array. 3. One drawback to the sequential search is that it cannot be used with an array that contains string elements. 4. The term parallel array is a synonym for a two-dimensional array.