What is Data Structure | Basic Types Of Data Structures

What is Data Structure?is a specialized method which helps in storing data. It allows you to perform operations in an efficient manner. The data structure includes different types of data types such as the array, the file, the record the table, the tree and so on.

What is Data Structure

Each data structure is designed to perform a specific function which can be accessed and worked with in a particular way. Data structure along with algorithm makes programs. Various algorithms are combined with a data structure to store data for the future purpose.

What is Data Structure : Basic Types of Data Structures

Space, where data is stored, is known as a data structure. The data structure is of two kinds: –

Built-in Data Structure

Built-in data structure is a simple type of data structure and also known as Primitive Data Structure. It is further of four categories: –

  • Integer
  • Float (Decimal value)
  • Character and strings
  • Boolean (true, false)

User Defined Data Structures

This a complex type of data structure which is used to store large and connected data. It is also known as Abstract Data Structure. User defined data structure is of three types: –

Array

Array is a set of similar values.

Linear Lists

Linked lists are used to store data in a linear fashion.

  • Linked list: – Linked list is used for dynamic memory allocation. In a long list, the data is arranged in a linear manner so that only one element can be directly reached.
  • Stack: – It works on the principle of first in last out the order. The elements which are inserted first into stack are removed at last.
  • Queue: – It works on the principle of first in first out principle. The elements first inserted are removed first.

Non-Linear List

In the non-linear file the data is attached several times in such a way that they show a relationship with each other.

  • Tree: – It stores data in a non-linear manner with one node and others sub-nodes.
  • Graph: – Graph is a data structure which consists of a limited set of vertices and a finite set of ordered pair of the form.
  • File: – It is a collection of data stored on mass storage.

These structures allow us to perform different operations on data. We can select a data structure according to our needs.

Array

It is a set of homogeneous data arranged in a systematic order is known as Array. Every element of the Array is known as an index. It includes rows and columns to access elements from the data structure. The range is primarily used for storing data till the completion of the program so that you can access the items from it anytime. Array performs some functions. Such as: –

  • It helps in adding numbers.
  • It also helps in sorting numbers and arranging them in rows and columns for future use.
  • It makes the searching of elements natural as the elements are arranged in rows and columns.
  • It helps in re-arranging the numbers during execution.
  • It performs matrix operations.
  • It also includes pre-fix and post-fix operations.

Array Representation

Array is declared in different ways in different languages. We are providing here an example of declaring an array in C-language.

int array[10] = {21,56,12,52,58,22,45,25,54,44}

Here, int defines the type of data stored means whole number integer value, the array is the name of the data structure, and [10] sets out the size of the array which means that it can hold up to 10 elements.

Matrix

Matrix stores the data in an organized way in the form of rows and columns. Models are used for graphing 3D projects. The primary uses of the Matrices are: –

  • It is used for creating 2-D and 3-D graphics and for creating and modifying images.
  • It is used for encryption/ decryption of codes and messages.
  • It is used to represent class hierarchy.
  • It is used to describe traffic flow in a network.
  • It is used to introduce graph theory of node representation in a system.

Algorithm

The algorithm is a finite set of instructions which is used to get desired output. It is core logic of the problem and combines with a data structure to form a code. The algorithm of a program which can be described in two ways: pseudo code and flowchart. An efficient algorithm is usually very fast and takes less time to execute. It also requires less space. The performance of the algorithm depends on two factors: –

Time complexity:- It represents the time needed by the program to run to completion. It is usually expressed by using the big 0 notation.

Space complexity: – Space complexity means the space required by the algorithm during execution. An algorithm requires three types of space for memory performance: Instruction space, Data space, Environmental space.

Characteristics of Algorithm

A good algorithm should have the following algorithms: –

  • It should be written in simple English.
  • The algorithm of a program should be clear, precise, lucid and unambiguous. It’s each step and inputs and outputs must be clear and should have only single meaning.
  • The inputs of the algorithm should be 0 or more well-defined.
  • It should include 1 or more well-defined outputs.
  • Algorithms should be terminated after processing a finite number of steps.
  • Algorithms of a program should be feasible with the available resources.
  • Algorithms of a program should be independent of coding and should follow step-by-step directions.

Conclusion

Data structure is a term used for storing data in different formats. The stored data may be the simple or complex type. The complexity of data depends on the amount and type of data stored in it. Different data types are meant for performing various functions. These data structures combine with algorithms to form a program. The algorithms of the program are straightforward and easy to use. They play different roles like insertion, deletion, search, merging, etc. The algorithm includes the coding of the program. Data structure helps in identifying the type of elements in it and their functioning.

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.