Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

As defined in the textbook slides: \"A data structure is a set of data objects t

ID: 3802568 • Letter: A

Question

As defined in the textbook slides: "A data structure is a set of data objects that are organized in some way." "A collection is a container for zero or more data objects." "An abstract data type (ADT) separates the user or client of a data structure from the implementer or server." "An ADT provides an interface or public set of abstract operations for accessing the objects in the data structure." We see that data structures, collections, and abstract data types are closely related concepts. Objects that are contained within these entities are typically called items or elements. From the object-oriented perspective, data structures have both private data and public behaviors. The behaviors define data structures in an abstract, implementation independent manner. Other equivalent terms used for behaviors are operations, methods, public interface, and usage interface. In this discussion, we explore the primary behaviors needed to use data structures. Some of these behaviors include: - Determine its size (number of items) - Test for item membership (presence or absence of an item) - Traverse through all its items - Get an item - Insert an item - Remove an item - Replace an item Discuss these behaviors. You don't have to address them all. Select one or more that interest you. What do they do? Are they needed or simply convenient? How are they the same across different types of data structures? How do they vary across different types of data structures? Do they have any efficiency issues? You could give a real-world example for one of the behaviors. You could give a visual depiction of one of the behaviors. You could discuss other primary behaviors not listed here. Reply

Explanation / Answer

Determine its size (number of items)

What do they do? It return size or number of element stored in data structure. For example if its a list then number of element of list or length of list. Similarly for stack, queue. All ds will require this method in some way or other.

Are they needed or simply convenient? In most data structures this is a needed method to traverse through all related element .

How are they the same across different types of data structures? They are same across datastructure in the sense it returns number of elements.

Do they have any efficiency issues? In general determining size doesn't have efficiency issue as size is always stored in some variable unless some kind of parallele execution is done where updating this variable might need some sort of concurrency control.

You could give a real-world example for one of the behaviors. Traversing a list will need its size.