Operations of Data Structure
In the following section, we will discuss the different types of operations that we can perform to manipulate data in every data structure:
1. Traversal:
Traversing a data structure means accessing each data element exactly once so it can be administered. For example, traversing is required while printing the names of all the employees in a department.
2. Search:
Search is another data structure operation which means to find the location of one or more data elements that meet certain constraints. Such a data element may or may not be present in the given set of data elements.
For example, we can use the search operation to find the names of all the employees who have the experience of more than 5 years.
3. Insertion:
Insertion means inserting or adding new data elements to the collection. For example, we can use the insertion operation to add the details of a new employee the company has recently hired.
4. Deletion:
Deletion means to remove or delete a specific data element from the given list of data elements. For example, we can use the deleting operation to delete the name of an employee who has left the job.
5. Sorting:
Sorting means to arrange the data elements in either Ascending or Descending order depending on the type of application. For example, we can use the sorting operation to arrange the names of employees in a department in alphabetical order or estimate the top three performers of the month by arranging the performance of the employees in descending order and extracting the details of the top three.
6. Merge:
Merge means to combine data elements of two sorted lists in order to form a single list of sorted data elements.
7. Create:
Create is an operation used to reserve memory for the data elements of the program. We can perform this operation using a declaration statement. The creation of data structure can take place either during the following:
- Compile-time
- Run-time For example, the malloc() function is used in C Language to create data structure.
8. Selection:
Selection means selecting a particular data from the available data. We can select any particular data by specifying conditions inside the loop.
9. Update:
The Update operation allows us to update or modify the data in the data structure. We can also update any particular data by specifying some conditions inside the loop, like the Selection operation.
10. Splitting:
The Splitting operation allows us to divide data into various subparts decreasing the overall process completion time.