Ds Introduction

DATA STRUCTURE:

Data structures are important as they provide the mechanism for defining what we can do with our data. Also, data structures can have certain performance characteristics, for example retrieving the value of an array at a specified index will always be the same no matter how small or large the index is.

Data structure is a particular way of storing and organizing information in a computer so that it can be retrieved and used most productively. Using data structures, from simple arrays to more complex trees, hash tables, or custom data structures, allows your code to both be more organized and extensible.
Using an array, which can either be created to hold the required number of elements or extended to hold more after it's first created keeps you from having to rewrite your code each time the number of data items changes.

Using an appropriate data structure allows you to design algorithms based on the relationships between the data elements rather than some fixed ordering, giving you more flexibility. Different kinds of data structures are meant for different kinds of applications, and some are highly specialized to specific tasks.

Data structures are important for the following reasons:

Data structures are used in almost every program or software system.

Specific data structures are essential ingredients of many efficient algorithms, and make possible the management of huge amounts of data, such as large integrated collection of databases.

Some programming languages emphasize data structures, rather than algorithms, as the key organizing factor in software design.

Classification of Data Structure:

Data structures can be classified as
1.Simple data structure
2.Compound data structure
3.Linear data structure
4.Non linear data structure

Simple Data Structure:

Simple data structure can be constructed with the help of primitive data structure. A primitive data structure used to represent the standard data types of any one of the computer languages. Variables, arrays, pointers, structures, unions, etc. are examples of primitive data structures.

Compound Data structure:

Compound data structure can be constructed with the help of any one of the primitive data structure and it is having a specific functionality. It can be designed by user. It can be classified as

Linear data structure:

Collection of nodes which are logically adjacent in which logical adjacency is maintained by pointers. Linear data structures can be constructed as a continuous arrangement of data elements in the memory. It can be constructed by using array data type. In the linear Data Structures the relationship of adjacency is maintained between the Data elements. In linear data structure the elements are stored in sequential order.

The linear data structures are

Array: Array is a collection of data of same data type stored in consecutive memory location and is referred by common name

Linked list: Linked list is a collection of data of same data type but the data items need not be stored in consecutive memory locations.

Stack: A stack is a Last-In-First-Out linear data structure in which insertion and deletion takes place at only one end called the top of the stack.

Queue: A Queue is a First in First-Out Linear data structure in which insertions takes place one end called the rear and the deletions takes place at one end called the Front.

Operations applied on linear data structure:

The following list of operations applied on linear data structures

>Add an element

>Delete an element

>Traverse

>Sort the list of elements

>Search for a data element

By applying one or more functionalities to create different types of data structures For example Stack, Queue, Tables, List, and Linked Lists.

Non-linear data structure:

Non-linear data structure can be constructed as a collection of randomly distributed set of data item joined together by using a special pointer (tag). In non-linear Data structure the relationship of adjacency is not maintained between the Data items.

Elements are stored based on the hierarchical relationship among the data. The following are some of the Non-Linear data structure

Trees: Trees are used to represent data that has some hierarchical relationship among the data elements.

Graph: Graph is used to represent data that has relationship between pair of elements not necessarily hierarchical in nature. For example electrical and communication networks, airline routes, flow chart, graphs for planning projects.

Operations applied on non-linear data structures:

The following list of operations applied on non-linear data structures.

>Add elements

>Delete elements

>Display the elements

>Sort the list of elements

>Search for a data element

If the data contains a single value this can be organized using primitive data type. If the data contains set of values they can be represented using non-primitive data types.

Classification of Data Structures:

If a data structure is created using static memory allocation (i.e. data structure formed when the no of data items are known in advance), it is known as static data structure or fixed size data structure.

If a data structure is created using Dynamic memory allocation (i.e. data structure formed when the no of data items are not known in advance), it is known as Dynamic data

structure or variable size data structure. Dynamic data structure can be broadly classified as

1.  Linear data structure

A Linked list is a linear dynamic data structure that has grown and shrink during its execution time.

A circular linked list is similar to linked list except that first and last nodes are interconnected.

2.  Non-linear data structure

It’s don’t have linear relationship between its adjacent elements.

In linear data structure, each node has a link which point to another node.
In non-linear data structure each node may point to several other node.

A Tree is a non-linear dynamic data structure that may point to one or more node at the time.

A graph is similar to tree except that it has no hierarchical relationship between its adjacent nodes.