Java Abstract data types

Source: Internet
Author: User

Abstract data Types
abstract data types are a theoretical tool for describing data structures. Before we introduce the abstract data types, let's introduce a
Basic concepts of the following data types.
A data type is a set of data elements of the same nature and a set of operations that are added to this set.
for the. For example, there are many different data types in the Java language, including numeric data types, strings, Boolean
and other data types. In the case of the int type in Java, the collection of data elements of type int is [ -2147483648,2147483647]
An integer, defined on which the operation is added, minus, multiply, divide arithmetic, and modulo operations.
defining the role of data types is to hide the computer hardware and its characteristics and differences, so that the hardware for the user is a transparent
That the user can not care how the data type is implemented and can use it. Defining another role for data types
is that the user is able to solve the problem easily by using the operation defined by the data type. For example, users can use the Java
The addition operation that defines the int type completes the addition of two integers without caring for the addition of two integers in the computer
how it is achieved. This will not only speed up the user to solve the problem, but also enable users at a higher level
consider the issue.
compared with the machine language, assembly language, the appearance of high-level languages is greatly simplified programming. But the answer is to ask
The steps from non-formal natural language expression to formal high-level language expression, is still a complex process, still
to do a lot of trivial things, so still need to abstract.
for a clear question, to answer this question, always select a data model of the problem first. Then, figure out
The initial state of the data model selected under known conditions and the required result state, as well as the implied two-shaped
the relationship between the States. Then explore the operations necessary to reach the required result state from the known initial state of the data model
when we explore the operation steps, we should first consider the operation steps of the top level, and then consider the underlying operation steps.
the so-called top-level operation steps are defined as the operation steps at the data model level, or macro operations. They make up the answer question
the main part of the problem step. The data involved in the data model is a variable, temporarily do not care about its data structure;
the operations involved take data variables in the data model as operands, or as results of operations, or both,
called an operation defined on a data model. Because the data structures of variables are not cared for temporarily, these operations are abstract in nature.
the details of the operation are not included. The so-called bottom-level operation procedure is the concrete implementation of the top abstraction. They depend on the data model
dependent on the specific representation of the data model structure. Therefore, the underlying operation steps consist of two parts: the first is the data
The concrete representation of the model, and the concrete implementation of the operation defined on the data model. We can interpret them as microscopic
operation. Thus, the underlying operation is the refinement of the top-level operation, and the underlying operation is the top-level operation service. In order to apply the top-level algorithm to the bottom
layer algorithms are separated so that they do not contain each other and affect each other at design time, and they must be abstracted once for their interfaces.
let the bottom layer only through this interface for the top service, the top layer only through this interface invoke the underlying operation. This interface is
abstract data type.
abstract data type, or ADT, consists of a data model and a
group operations.
abstract data types include the definition and implementation of two aspects, where the definition is independent of implementation. The abstract data type is determined by the
righteousness depends only on its logical nature, and not its implementation within the computer, that is, regardless of how its internal structure changes,
as long as its logical nature does not change, it will not affect its use. Changes in the internal (abstract data type implementation)
It is possible to have an impact on the efficiency of the external use of the problem when it is used to solve problems, so one of our important tasks is to
simple and efficient way to implement abstract data types. It is clear that for different operations groups, the efficiency of all operations in the group
are as high as possible, their corresponding data models specifically represent choices that will be different. In this sense, the data model
specific representations are also dependent on those operations defined on the data model. In particular, when the efficiency of different operations is constrained to each other,
The corresponding usage frequency of all operations must be sorted beforehand so that the specific representation of the selected data model is guaranteed to be used
the operation with higher frequency has higher efficiency.
we should see that the concept of abstract data types is not a new concept. Abstract data types and data types in real
is a concept, but a further abstraction of the data type, not limited to a variety of different computer processors
the data types that have been implemented also include complex data types that are user-defined to solve more complex problems. For example
a high-level language has an "integer" type that is an abstract data type, except that the introduction of an integral type in a high-level language is implemented,
and the details of the implementation may be different. We do not realize that the concept of abstract data types has been conceived in basic data classes
because we are accustomed to using basic data types and related operations in programming, without
To dig deeper.
abstract data types on the one hand, the person who uses it can only care about its logical characteristics, and does not need to know its implementation side
type. On the other hand, it makes it easier to describe the real world, so that we can think about it at a higher level.
For example, you can use a tree to describe administrative divisions and use diagrams to describe communication networks.
based on the concept of abstract data types, the definition of abstract data types is the name of the contract abstract data type .
, the name of each operation of the set of operations defined on the type is specified, and the number of arguments for each operation
number, the meaning and order of these parameters, and the function of the operation. Once defined, people can use it as a reference
basic data types, it is easy to reference abstract data types, and the implementation of abstract data types has a design
the basis and objectives. The use and implementation of abstract data types deal with the definition of abstract data types so that the use and
There is no direct link. Therefore, the use and implementation of abstract data types can be independent of each other as long as they are defined strictly by definition .
they are isolated from each other and achieve abstract purposes.
for this abstract data type, you can use a ternary group to represent:
ADT = (D, S, P)
where D is the data object, S is the set of relationships on D, and P is a set of actions that are added on D.
when defining an abstract data type, we use the following format:
ADT Abstract Data type name {
data Object:< definition of data object >
data Relationship:< definition of data relationship >
basic Operation:< Definition of basic operation >

For more highlights, please follow:

Focus on Superman Academy QR Code: 650) this.width=650; "Src=" " alt= "161340_vvpq_2273204.jpg"/>

Focus on the Superman college Java Free Learning Exchange Group: 650) this.width=650; "Src=" Http:// 2273204.png "alt=" 161340_wcey_2273204.png "/>

Java Abstract data types

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.