Data Struct and Data Type

Data structures, data types

Looking at Javathe HashMapbefore, spots a little important data structure points.

1. The data structure (data structure)

  1. Expression data structure is: What kind of structures, a type of data organization.

  2. Into logical and physical structure:

    • Basic logic structure: collection, linear structure, a tree structure, FIG;
    • Physical Structure: sequential storage, the storage chain;

2. The data type (data type)

  1. Data types and data structures are closely related, that is: a set of values ​​and a set of definitions of operating in this general term value set.

    For example: C language A data types: integer variable which is an integer value set, the operation is defined in such a range on the integer addition, subtraction, multiplication, division and modulo arithmetic and the like.

  2. Advanced data type language into two categories:

    • Atomic Type: Value can not break down, is what it is. Such as integer, character and the like;

    • Structure type: The value is composed of several ingredients in certain structures, and therefore decomposable, and its component may be the type of atom type may be a configuration. Such as arrays, which value is determined by the composition of several components, each component may be an integer, or may be an array.

      • Therefore, the structure can be viewed as a type of a data structure and a set of operations defined in its composition.
  3. So you see, just the data structure represents a structure, and we use data types in programming languages, programming language if you want to achieve some kind of data structure, it must be packaged as a data type, more narrowly say type of data structure types.

3. In-depth understanding of

Maybe you still some chaos, but it does not matter, where you fall asleep on where thing - I repeat the point you make in-depth understanding of ...

  1. Indeed, in the computer, the data type is not limited to the concept of high-level languages, each processor [a] provides a group of atoms or struct type.

    • For example, a computer system typically contains hardware "bit", "byte", "character" and other types of atoms, their operations by a computer system to complete a set of instructions designed directly by the circuitry;

    • And the data type provided by the high level language, to be translated into the underlying its operation by a compiler or interpreter, i.e., assembler or machine language, data type be implemented.

  2. Introduction of the "data type" of the object,

    • From a hardware perspective, as a means to explain the meaning of the information in the computer memory,

    • The use of user data types, the realization of the hidden information, the user does not have to understand everything is about the details are encapsulated in type.

      • For example, when the user using the "integer" type, neither understand "integer" showing how the inside computer and does not need to know how the operation is achieved.
      • Such as the "sum of two integers", programmers focus on only its "mathematical sum," the abstract properties rather than its hardware "bit" how to operate.

    ([A]: the data processing unit is not limited to the CPU, including hardware, operating system , high-level language, database , etc.)




Therefore, 
the use of "data structure" is a data type used in layer by layer is encapsulated in a programming language 
used in the programming language "data structure" is used in the encapsulated layer is a layer of a datatype 
using "data structure" is a layer by layer using some type of data encapsulated in the programming language




The java hashmap

FAQ:

    1. Why should there be HashMap?

      A: I'm looking forward to using this data structure Hash tables in Java, because it's quick access feature.

    2. Hash tables and HashMaprelationships?

      A: Hash table is a logical data structure HashMapis a data type (structure type) Java is that by this code implements Hash table data structure, and defines a series of operations on this structure.

    3. This chapter we should be doing?

      A: The first thing to understand what we are doing, we are in a data structure called a hash table of analysis do?

      Not! Not! Not! We are talking about a certain type of data to achieve a high-level programming language, which implements the hash table this data structure, but it is by no means the hash table itself, it is its own -  HashMaptype.

      Do not understand the words I say again: Do you remember your school Map( HashMapthe first sentence description to see the parent Interface) "An object that maps keys to values." Translation is simple: Map is a key object. However, nobody can tell you that the hash table is the key to the structure.

    4. Java data types

      A: Some do not understand, then say it, in fact, easy to make people do not understand. So I want to say:

      • Indeed, a programming language data types are the result of the layers of the package;
      • In fact, Java classes are only three data types: primitive types (primitive8 a), arrays, Object;
      • In fact, regardless of the official set of framework or, create your own class or whatever, can only be derived from the Object and depends on the original three classes of data types;
      • Finally, now you will probably find, "array" of this type could be so important in Java, without the array as infrastructure, you are impossible to construct any type of Object want to achieve some kind of data structure .

Guess you like

Origin www.cnblogs.com/Dfrank/p/11620076.html