Question: answer in java please 6. Simple Container Classes a. Given a bag, describe its contents (abstract value) after the series of operations: insert 42, insert

6. Simple Container Classes a. Given a bag, describe its contents (abstract value) after the series of operations: insert 42, insert 5, insert 56, insert 12, insert 29, insert 8 b. Given a sequence, describe its contents (abstract value) after the series of operations: addBefore 42, addAfter 5, addAfter 56, addBefore 12, addBefore 29, addBefore 8 c. How do the bag and sequence differ even though they contain the same values? d. Draw a picture of the internal contents (instance variables) of the sequence where the series was applied Be complete with your picture. e. Describe the representation of the sequence as we implemented it with a partially-filled array. 6. Simple Container Classes a. Given a bag, describe its contents (abstract value) after the series of operations: insert 42, insert 5, insert 56, insert 12, insert 29, insert 8 29 42 5 56 8 12 size: 6 b. Given a sequence, describe its contents (abstract value) after the series of operations: addBefore 42, addAfter 5, addAfter 56, addBefore 12, addBefore 29, addBefore 8 42 5 8 29 1256 Size: 6 c. How do the bag and sequence differ even though they contain the same values? The order of the items is important in sequence, as is the concept of a current element d. Draw a picture of the internal contents (instance variables) of the sequence where the series was applied. Data: 42 5 manyltems 6 current 2 8 29 1256 ? ? ? ? Be complete with your picture. e. Describe the representation of the sequence as we implemented it with a partially-filled array. Elements are in order and are stored from data[0] through data[manyltems-1). Current keeps track of index of current element
Step by Step Solution
There are 3 Steps involved in it
Certainly Heres how you can implement the described operations in Java Part a Bag A bag or multiset ... View full answer
Get step-by-step solutions from verified subject matter experts
