Classification of Data Structure

Harsh Gupta - Tech Writer
Basically data structure is of two types:

1. Primitive data structure.

2. Non primitive data structure.

Further they are divided in to different categories

Primitive data structure: It's a basic data structure and it's directly operated upon the machine instructions. These structures have different representation on different computers.

Primitive data structure includes:

Integers, floating numbers, character constants, string constants, pointers etc.

INTEGERS:

The quantity representating objects that are discrete in nature can be represented by an integer.

For example: 2, 4, 6, 0, -23,-56 etc. are integers but 2.5, -34.56 are not integers.

FLOAT:

Float is a simple data type which takes 4 bytes in memory and we can assign decimal number in to it.

For example: 2.5, 245.67 etc.

CHRACTERS:

Characters are the literal representation of some elements selected from alphabets and characters are defined in the single quotes. There are wide varieties of character sets. Two widely used character sets are represented by

EDBIC and ASSII.

For example: '*', 'r', 'A', '2' etc. are constants.

POINTERS:

Pointers is a reference to the data structure and a simple type of variable which store the address of the another variable. Pointer is a single fixed size data item.

For example:

Int x;

Int *p;

P=&x;

Here x is the integer, where p is a pointer of integer type and pointer p points to x.

NON PRIMITIVE DATA STRUCTURE:

These are more sophisticated data structure and also these are derived from the primitive data structure. The non primitive data structure defines the group of homogenous and heterogeneous data items.

Array, List, Files are the examples of non primitive data structure.

ARRAY:

An array is a finite set of homogenous elements or data items. It means an array can contain one type of data, either all integers or characters.

Declaration of an array:we declare an array like int a[n].

Here 'a' be the name of an array and 'n' denotes the number of elements; an array can store this is called the length/size of an array and 'int' represents that this array contain only integer type of elements.

· The 1st element of an array has index zero.

· The element of an array will always be store in consecutive memory location.

· An array can always be read or write through loops.

· If we read one dimensional array; it requires only one loop and for two dimensional arrays; we require two loops and so on for n-dimensional array.

For reading an array:

for(i=0;i{

scanf("%d", &a[i]);

}

For writing an array:

for(i=0;i{

printf("%d", a[5]);

}

LIST:

List refers to as 'linear link list' and a list can be define as a collection of variables, or data items. Lists are most commonly used as non primitive data items. The element of list contains atleast two fields.

· One for storing the data items known as information field.

· Second for storing the address of next element known as pointer field.

For storing the address of the next element; we make the use of pointers and each data item is refer to as nodes. So we can also say that list is a finite collection of nodes.

Published by Harsh Gupta - Tech Writer

I am a part time freelancer and writing is my hobby Some of my websites: http://www.GenericArticles.com http://www.JailBreakingiPhone.com  View profile

  • List refers to as 'linear link list' and a list can be define as a collection of variables, or data.
  • An array is a finite set of homogenous elements or data items.
These are more sophisticated data structure and also these are derived from the primitive data structure. The non primitive data structure defines the group of homogenous and heterogeneous data items.

To comment, please sign in to your Yahoo! account, or sign up for a new account.