DS & A (DATA STRUCUTRES)
| CHAPTER 1 |
What is Data Structures?
Data Structures are any data representations and it's associated operations. It is also defined as the implementation of ADT(Abstract Data Type, We will learn about Abstract Data Type later).
E.g. Integer: Summation
String: Replace
Note: There are different types of data Structures and no particular data structure is better than the other in all cases, it all comes down to a number of factors depending on which a certain type of Data Structure is suitable for a certain problem. Resource Constraints such as Time consumption and space(memory) availability are the two major factors that determine the efficiency of a certain data structure.
Selecting Efficient Data Structure for a problem
- Carefully analyze the problem and figure out the resource constraints.
- Determine the basic operations and quantify the resource constraints for each operation.
- Select the data structure that best meets the requirements.
Note: In the second point I used the term "quantify" which basically means we have to assign an equivalent or proportional value to the resource constraints which can present a clear image of the efficiency of each data structure. It will also make comparisons between different data structures easier.
Some Key Terms :
Type: A type is a collection of Data. E.g. Integer Type: Collection of integers (1,2,3,4...)
Data Type: A type and a collection of operations that manipulate the type is called Data Type. E.g. Integer Data Type: Integer type and binary operations.
Data Types can be further classified as Atomic Data Type(Integer - no subparts) and Structure Data Type(Array - made of data items).
Data Item: A piece of information of a record drawn from a data type is called Data Item. E.g. true or false: The information is drawn from Boolean Type
What are Abstract Data Types?
Abstract Data Type or ADT can be defined as a definition for a Data Type or a class of objects solely in terms of a set of values and a set of operations on that Data Type.
So, In terms of ADT Data Structures can be defined as the Physical implementation of ADT.
ADT v/s Data Type...
ADT = Type + Operations and Data Type = Type + Operations. That raises the question, how is ADT different from Data Type? The main difference is :
ADT: An Abstract Data Type(ADT) is the specification of a Data Type within some programming language, independent of an implementation.
Data Type: Data Type is a type with a collection of operation that manipulates the type and is not just specification, unlike ADT.
Logical v/s Physical Form [of Data Items]
Data Items have both Physical and Logical Form.
- Logical Form: Definition of a data item within ADT.
- Physical Form: Implementation of a data item within Data Structure.
( If you like the content here, follow TSP on social media to get notified on future updates)
Comments
Post a Comment