what is the difference between abstract and primitive data types.
difference between abstract and primitive data types
Imran- Guest
Abstract : A set of data values and associated operations that are precisely specified independent of any particular implementation.
For Example : Stack is an Abstract Data Type.
Methods involved in stack would be:
- Push an element into the stack.
- Pop and element from the stack.
- Check the Top of the stack.
Abstract Data Type : Abstract data type (ADT) is a specification of a set of data and the set of operations that can be performed on the data.
Examples of Abstract Data Types:
1. List
2. Priority queue
3. Queue
4. Stack
5. String
6. Tree
For Instance: User wants to makes certain calculations on 2 numbers (a and b).
1. Create an instance of a rational number ADT using two integers, a and b.
2. Operations: addition, subtraction, multiplication, division, exponentiation, comparison, simplify, conversion to a real (floating point) number.
3. We write a Method performing the above functions by passing the variables a and b.
Note: Taking the above definition into consideration here a and b are data values and addition, subtraction, multiplication, division, exponentiation, comparison, simplify, conversion to a real (floating point) number associated operations.
--------------------------------------------------------------------------
Primitive: being the first or earliest data types created by the designers of the programmers.
For example early man are the Primitive people of the world.
Primitive Data types : The Data types created for the usage in the programming language when the Programming language was first designed and launched.
For example :
Typical basic primitive types may include:
1. Character (character, char);
2. Integer (integer, int, short, long, byte).
3. Floating-point number (float, double, real).
4. Boolean having the values true and false.
5. Reference (also called a pointer or handle), a small value referring to another object's address in memory, possibly a much larger one.
For Example : Stack is an Abstract Data Type.
Methods involved in stack would be:
- Push an element into the stack.
- Pop and element from the stack.
- Check the Top of the stack.
Abstract Data Type : Abstract data type (ADT) is a specification of a set of data and the set of operations that can be performed on the data.
Examples of Abstract Data Types:
1. List
2. Priority queue
3. Queue
4. Stack
5. String
6. Tree
For Instance: User wants to makes certain calculations on 2 numbers (a and b).
1. Create an instance of a rational number ADT using two integers, a and b.
2. Operations: addition, subtraction, multiplication, division, exponentiation, comparison, simplify, conversion to a real (floating point) number.
3. We write a Method performing the above functions by passing the variables a and b.
Note: Taking the above definition into consideration here a and b are data values and addition, subtraction, multiplication, division, exponentiation, comparison, simplify, conversion to a real (floating point) number associated operations.
--------------------------------------------------------------------------
Primitive: being the first or earliest data types created by the designers of the programmers.
For example early man are the Primitive people of the world.
Primitive Data types : The Data types created for the usage in the programming language when the Programming language was first designed and launched.
For example :
Typical basic primitive types may include:
1. Character (character, char);
2. Integer (integer, int, short, long, byte).
3. Floating-point number (float, double, real).
4. Boolean having the values true and false.
5. Reference (also called a pointer or handle), a small value referring to another object's address in memory, possibly a much larger one.