About Me

My photo
I am a kind of person who is looking forward to build a progressive career in a challenging environment and to present myself with best of my innovative ideas and technical skills. I have completed B.Tech in COMPUTER SCIENCE & ENGINEERING with “Honours” from College Of Engineering Roorkee (COER), Roorkee, affiliated to Uttar Pradesh Technical University,Lucknow. M.Tech from UTU, Dehradun. Ph.D pursuing from AMITY UNIVERSITY, NOIDA. My research areas are Data Mining and Data Analytics. Software Engineering, Artificial Intelligence.

Thursday, September 17, 2009

PPL Abstract data types

Structured and Abstract Data Types

A structured data type is simply a composition of several elementary data types or several other structured data types. An abstract data type is basically a data type that can have the characteristics of an elementary data type or a structured data type.

Structured Data Types

A structured data type is simply a composition of several elementary data types or several other structured data types. Since there are so many types of structured data, it would be helpful to lay out the basic characteristics of structured data. Structured data types can either have a fixed or a variable number of components. Components in a structured data type can be heterogeneous or homogenous. They can be of the same type or of different types. Names can be used to identify each component in a structured data type. There are limits as to how many components can be included in a structured data type. Components in a structured data type are also organized in vectors or in dimensions.
There are also many types of operations on structured data types. A component selection operation can be done sequentially. Sequential selection happens when the accessing formula follows a base address and then an offset calculation. Linked representation selection happens when a pointer is used to identify the component through a series of chains. Components can be deleted and can be added in a structured data type. A whole data structure may be created or may be dissolved anytime. Declarations can be made on structured data types. You can declare a structured data type to be a set of integers, floating point numbers, or whatever data type you want.
There are several structured data types. Arrays are a fixed number of homogeneous components. A one dimensional array is called a vector while a two dimensional array is called a matrix. You can use arrays for data that involves several elementary data types like names and numbers. There are four types of arrays. A static array is an array with subscript ranges that are statically bound and storage locations that are statically bound as well. This means that if you utilize and array within a given function, you can not use it outside the said function anymore. Memory consumption for a static array is already predefined even before a program is run. A fixed stack dynamic array is an array with subscript ranges that are statically bound but instead of having statically bound storage locations, allocation is done during execution. This fixed stack dynamic array can only be utilized within the function where it was declared. Memory consumption is used when the program is in execution. A stack dynamic array has both its subscript ranges and its storage allocation dynamic. If your arrays are stack dynamic, this means that you can use your arrays across several functions within a program. Memory consumption for these arrays is also done during program exexution. A heap dynamic array also has both the subscript ranges and storage allocation dynamic plus you can also change them anytime during the lifetime of the array. When your arrays are heap dynamic, this means that you can practically change your arrays anytime you want, even while the program is running. Memory allocation for the arrays is also done during execution.

The illustration shows a vector and a matrix. One dimensional arrays are called vectors. Two dimensional arrays are called matrices.
Records are a fixed number of heterogeneous components. Records can also be called fields. Records utilize linear representation using a single block of sequential memory. Records also use identifier names or field names for their components.
Union types are structured data types that are capable of storing different data type values at different times during program execution. A union type is most useful when one needs a data object that can be interpreted in a variety of ways.
Lists are basically structured data types that are composed in an ordered sequence of data structures. It can vary in length and the components may be heterogeneous or homogeneous. Every node on a list is called a list item. List items can either be another list or an element called an atom with a value.
Sets are structured data types that are composed of an unordered collection of distinct values. Sets are usually stored as bit strings. A bit value of 1 represents the presence of an element while a bit value of 0 represents the absence of an element. Operations on sets include membership, insertion and deletion, unions of sets, intersections of sets, and differences in sets. Operations on sets are implemented using the Boolean values AND, OR, and NOT.
Files are structured data types that have a lifetime that is greater than the time of the program creating it. They can be represented on a secondary storage device. Sequential files are basically files that are composed of a linear sequence of components of the same type. They can vary in length wherein the components can be added, deleted, read, opened, written on, closed, or whatever action need be done to it. Direct access files are files where any single component may be accessed at random. A key is used to select a component where read and write operations can be done. Indexed sequential files have characteristics of sequential files and direct access files. A key is used to select a component and the next action can choose the next component in a sequence.
Abstract Data Types
An abstract data type is basically a data type that can have the characteristics of an elementary data type or a structured data type. In fact, in most programming languages, a programmer is the one who defines what an abstract data type will be. Abstract data types are abstract mainly because they are independent of any sort of definition or implementation. There is absolute freedom on what the programmer wants to do with a data type classified as abstract. For example, a programmer may want to create an associative array. It is basically an array composed of keys associated with one value. An associative array has features of an enumeration and features of an array, features of an elementary data type and features of a structured data type, respectively. There are many more abstract data types that can be created like complex numbers, priority queues, etcetera…

No comments:

Post a Comment