What is Abstract Data Type(ADT) In Java Data Structure?


Before start learning ADT we will learn about data an data structure, below we will cover all ADT Topics related to In Data Structure.


Data Types & Data Structures

  • Applications/programs read data, store data temporarily, process it and finally output results.

  • What is data? Numbers, Characters, etc.





  • Data is classified into data types. e.g. char, float, int, etc.

  • A data type is:

(i) a domain of allowed values and

(ii) a set of operations on these values.

  • Compiler signals an error if wrong operation is performed on data of a certain type.

For example,

  • char x,y,z;

  • z = x*y is not allowed.


Example:







  • int i,j -> i, j can take only integer values and only integer operations can be carried out on i, j.

  • Built-in types: defined within the language e.g. int,float, etc.

  • User-defined types: defined and implemented by the user e.g. using typedefor class

Simple Data types: also known as atomic data types -> have no component parts. E.g. int, char, float, etc.





Structured Data types: can be broken into component parts. E.g. an object, array, set, file, etc. Example: a student object.







A data structure is a data type whose values

  • (i) can be decomposed into a set of component elements each of which is either simple (atomic) or another data structure

  • (ii) include a structure involving the component parts.

  • A data structure is a collection of data, organized so that items can be stored and retrieved or removed by some fixed techniques


Possible Structures: Set, Linear, Tree, Graph.











What is the domain of a structured data type? Operations?


Example: boolean[] Sample= new boolean[3];







Example: Operations:

Sample[0] = True;

boolean C = Sample[1];









Abstraction? Anything that hides details & provides only the essentials.

Examples:

an integer 165 = 1.10^2+6.10^1+5.10^0, procedures/subprograms, etc.


Abstract Data Types (ADTs): Simple or structured data types whose implementation details are hidden…


While designing ADTs, a designer has to deal with two types of questions:

(i) What values are in the domain? What operations can be performed on the values

of a particular data type?

(ii) How is the data type represented? How are the operations implemented?


ADTs

  • ADTs specification answers the ‘what’ questions. Specification is written first.

  • ADTs implementation answers the ‘how’ questions. Done after specification.

  • Users & Implementers:

* Users of an ADT need only know the specification …. No implementation details.

<- advantage

* Programmer (Implementer) who implements ADT is concerned with..

specification, representation, implementation.










Example:

ADT String1

Specification:

Elements: type char.

Structure: elements (characters) are linearly arranged.

Domain: type String, finite domain, there are 0 to 80 chars in a string, therefore 1+128+1282+…..+12880 possible stings in the domain.

Operations: Assume that there is a string S.

1.Procedure Append (c: char)

Requires: length(S) < 80.

Results: c is appended to the right end of S.



ADT String: Implementation
















































If you need any programming assignment help in Java programming, Java project or Java homework or need solution of above problem then we are ready to help you.


Send your request at realcode4you@gmail.com and get instant help with an affordable price.


We are always focus to delivered unique or without plagiarism code which is written by our highly educated professional which provide well structured code within your given time frame.


If you are looking other programming language help like C, C++, Java, Python, R, PHP, Asp.Net, NodeJs, ReactJs, etc. with the different types of databases like MySQL, MongoDB, SQL Server, Oracle, etc. then also contact us.