In computer terms, a data structure is a Specific way to store and organize data in a computer's memory so that these data can be used efficiently later. Data may be arranged in many different ways such as the logical or mathematical model for a particular organization of data is termed as a data structure. The variety of a particular
data model depends on the two factors -
The data structure can be sub divided into major types:
- Linear Data Structure
- Non-linear Data Structure
A data structure is said to be linear if its elements combine to form any specific order. There are basically two techniques of representing such linear structure within memory.
1. Provide the linear relationships among all the elements
represented by means of linear memory location. These linear structures are termed as arrays.
2. Provide the linear relationship among all the elements
represented by using the concept of pointers or links. These linear structures are termed as linked lists.
The common examples of linear data structure are:
This structure is mostly used for representing data that contains a hierarchical relationship among various elements.
Examples of Non Linear Data Structures are listed below:
Tree: In this case, data often contain a hierarchical relationship among various elements. The data structure that reflects this relationship is termed as rooted tree graph or a tree.
Graph: In this case, data sometimes hold a relationship between the pairs of elements which is not necessarily following the hierarchical structure. Such data structure is termed as a Graph.
Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array.
Element − Each item stored in an array is called an element.
Index − Each location of an element in an array has a numerical index, which isused to identify the element.
Arrays can be declared in various ways in different languages. For illustration, let's take C array declaration.
Arrays can be declared in various ways in different languages. For illustration, let's take C array declaration.
As per the above illustration, following are the important points to be considered.
Following are the basic operations supported by an array.
1. Traverse − print all the array elements one by one.
2. Insertion − Adds an element at the given index.
3. Deletion − Deletes an element at the given index.
4. Search − Searches an element using the given index or by the value.
5. Update − Updates an element at the given index.
LECTURE NOTES Prepared by Dr. Subasish Mohapatra