2

Possible Duplicate:
What is the difference between a composite data type and a data structure?
Explain the difference between a data *structure* and a data *type*

I was reading a book on data structure and here is what i could understand (correct me if i am getting it wrong)

In Computer science, data is stored in 1 and 0 , but for programmers convenience, all languages have primitive data types and data is stored as primitive data type rather than worrying about 1 and 0.

Going one level up, another abstraction was devised and composite data (or object in java) was used to contain primitive data type and that helped in manipulating data easily.

Last level of abstraction was data structure where data is stored in different ways depending on different use cases and that provides flexibility in manipulating data .

For each data structures, different operations are defined so that it is easier to manipulate data .

Please share your views.

Community
  • 1
  • 1
AKS
  • 1,393
  • 3
  • 19
  • 29
  • Data structures, as I understand it, are about _collections_ of similar data (linked lists, jump lists, trees, queues, stacks etc). Data types are the data in each item in the collection. – Oded Dec 26 '12 at 21:35

1 Answers1

1

Data structure is a mathematical object with some set of properties that can be realized in many different ways as data types. A data type is just a class of values that can be concretely constructed and represented.

Example: int is a datatype but not a structure. Whereas struct point { int x; int y; } is both a structure and a datatype.

More info:

Data structure: is an abstract description of a way of organizing data to allow certain operations on it to be performed efficiently. For example, a binary tree is a data structure, as is a Fibonacci heap, AVL tree, or skip list. Theoreticians describe data structures and prove their properties in order to show that certain algorithms or problems can be solved efficiently under certain assumptions.

Data type: is a (potentially infinite) class of concrete objects that all share some property. For example, "integer" is a data type containing all of the infinitely many integers, "string" is a data type containing all of the infinitely many strings, and "32-bit integer" is a data type containing all integers expressible in thirty-two bits.

Srujan Kumar Gulla
  • 5,721
  • 9
  • 48
  • 78
  • That means ..Both Data type and Data Structure stores data but difference lies in how data is stored. In Data type data can be stored in any way (Java Object eg. Address Object) but in data structure , data will be stored and arranged in particular fashion. and that is done so that few basic operations can be performed on data structure efficiently. Right? – AKS Dec 26 '12 at 21:44