Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

What are different types of data structures?

What is a Data Type?

A data type can be considered to be a method of interpretation of the pattern of bits and are of the following types:
1. Intrinsic data types: These are the in built data types in a programming language. These data types make the processing and storage of the data quite easy and efficient. This set of data type vary with the data bases and programming languages. Some are:
a) Integer
b) Boolean
c) Real
d) String
e) Character
f) Container
g) Date

2. User defined data types: It is defined by the users so as to have a data type containing instances of the several intrinsic data types mentioned above.

What are Data Structures and their types?

The data structures can be defined as a collection of several data items of different types stored together in a way that is clearly defined. Below we are going to discuss about some of the data structures:
1. Array data structure:
This data structure serves as storage for a number of elements of similar type but in a specific order. These elements are then accessed with the help of an integer that specifies the required element. Arrays may or may not have a fixed size and may be expandable.

2. Record:
This data structure is more commonly known as the struct or tuple and is among the simplest form of the data structures. This data structure is more like a value which stores other values in a fixed sequence or number or by names. Elements contained in it are called the members or fields.

3. Map or Hash:
This data structure is a flexible form of the record where the addition and deletion of the name – value pairs takes place freely.

4. Union:
This data structure stores a specific number of values among the permitted primitive types in its instance such as the integer, float and so on.

5. Tagged union:
This data structure is also known by the following names: disjoint union, variant record, variant or discriminated union. This data structure consists of an additional field with an indication of its current type for the enhancement of the safety.

6. Set:
This data structure is of abstract data type and stores specific values. The values are not repeated and also no particular sequence is followed. Values from the sets cannot be retrieved by themselves rather a value is tested for membership for obtaining a Boolean value either “not in” or “in”.

7. Object:
An object is another data structure that consists of a number of data fields such as a record, a number of program code fragments for the purpose of access and modification. Data structures that do not contain any code are termed as plain old data structures.

Out of the above mentioned data structures the most common ones are the arrays and records.

How are arrays and records used as data structures?

– The way of declaration of the data structures is quite similar to the standard variables with the exception of the inclusion of the array dimensions and size.
– Arrays can be either one dimensional or two dimensional or even multi-dimensional.
– To use an array along with the other data types, it needs to be defined within a record and then it can be declared to contain items of the record data type.
– Each of the records created then can be stored as the individual element of the array. An example is given below:
RECORD customer
Name: string data type
Gender: character data type
Age: integer data type
END RECORD
– Declaration of the array for the above will then be as follows:
Abc myarray[3] as record
– Proper initialization of the array is also important.
– In this procedure you set every value in the array with some starter values.
– This starter value could also be given as null for data types such as string or 0 for a floating or an integer array.
– A serial search can be performed on the array later whenever a particular record is required.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>