R 1.
What is a data structure?
Chapter ExercisesReview QuestionsR 1.
What is a data structure?R 2.
Define each of the following terms: collection, container, and sequence.R 3.
What is a Bag ADT and how does it differ from Python's list type?R 4.
What is an iterator and why should a container type implement an iterator?R 5.
What is some of the criteria used to select a data structure for implementing an abstract data type?R 6.
The Map ADT is a container, but is a linear structure? Explain your answer.ExercisesE 1.
Complete the Map class that uses parallel lists for storing the map entries by implementing the clear , remove , and valueOf methods.E 2.
Complete the Map class that uses a single lists for storing the map entries with storage objects by implementing the clear , remove , and valueOf methods.E 3.
Add a new operation keyList to the Map class that returns a Python list containing all of the keys stored in the map. The list of keys should be in no particular order.E 4.
Add Python operators to the Map class that can be used to perform similar operations to those already defined by named methods:
E 5.
Design and implement the iterator class MapIterator for use with the Map ADT implemented using a single Python list.E 6.
Implement the totalCount method of the Histogram class.Programming ProjectsP 1.
A Grab Bag ADT is similar to the Bag ADT with one difference. A grab bag does not have a remove operation, but in place of it has a grabItem operation, which allows for the random removal of an item from the bag. Implement the Grab Bag ADT.P 2.
A Counting Bag ADT is just like the Bag ADT but includes the numOf(item) operation, which returns the number of occurrences of the given item in the bag. Implement the Counting Bag ADT and defend your selection of data structure.P 3.
Design and implement an ADT to represent a standard deck of 52 playing cards.P 4.
Anyone who is involved in many activities typically uses a calendar to keep track of the various activities. Colleges commonly maintain several calendars such as an academic calendar, a school events calendar, and a sporting events calendar. We have defined an Activities Calendar ADT below that can keep track of one activity per day over a given range of dates. Select a data structure and implement the ADT.
|