A data structure is a special way of organizing and storing data in a computer so that it can be used efficiently. Array, LinkedList, Stack, Queue, Tree, Graph etc are all data structures that stores the data in a special way so that we can access and use the data efficiently. Each of these mentioned data structures has a different special way of organizing data so we choose the data structure based on the requirement, we will cover each of these data structures in a separate tutorials.
Data Structure plays a very important role in various algorithms, it allows the programmer to handle the data efficiently. In layman’s terms you can say that the data structure allows faster data storing and retrieval.
Data Structure Types
We have two types of data structures:
1. Linear Data Structure
2. Non-linear Data Structure
Linear data structures: Elements of Linear data structure are accessed in a sequential manner, however the elements can be stored in these data structure in any order. Examples of linear data structure are: LinkedList, Stack, Queue and Array
Non-linear data structures: Elements of non-linear data structures are stores and accessed in non-linear order. Examples of non-linear data structure are: Tree and Graph
Classification of Data Structure with Diagram
Why we need data structures?
Speed: Speed is an important factor when we are processing the data. Suppose an organization has thousands of employee records and they want to look up to an employee record, the process needs to be fast as possible to save time, nobody is willing to spend 10 minutes to look up a record in database.
Data structures allows faster retrieval, addition, deletion and modification of records.
Save disk space: When we are dealing with large amount of data, it becomes important to save the disk space as much as possible. Data structure allows efficient storing of data thus allows disk space saving.
Handling multiple requests: Data structure allows multiple data processing requests. For example, one person fetching the record while other person is simultaneously updating the data. Data structure allows multiple users to handle, access and modify data simultaneously.
Advantages of DS
We need data structures because there are several advantages of using them, few of them are as follows:
1. Data Organization: We need a proper way of organizing the data so that it can accessed efficiently when we need that particular data. DS provides different ways of data organization so we have options to store the data in different data structures based on the requirement.
2. Efficiency: The main reason we organize the data is to improve the efficiency. We can store the data in arrays then why do we need linked lists and other data structures? because when we need to perform several operation such as add, delete update and search on arrays , it takes more time in arrays than some of the other data structures. So the fact that we are interested in other data structures is because of the efficiency.
3. Reusability: Data structure can be reused. Once we have implemented a data structure, the same data structure can be used later.
4. Abstraction: Data structure hides (abstracts) the implementation details from the user. The user access the data through an interface and enjoys the benefits of data structures, the important complex implementation details are hidden from the user.
Leave a Reply