In this tutorial we are going to learn about data, data structures, types and why it is needed, data structure vs dbms and classification of data structure.
before going to the next step for data structures we need to understand what its terminology data and the structure. Understanding the data structures is always critical for becoming a good programmer.
must read:
Algorithms Analysis and why it is important? : DSA
How to Do Masters in Computer Science in INDIA? [2022-23]
How to Create Beautiful Info Cards – CSS Tutorial for Beginners
What is Data?
Data is a rough collection of some facts as numbers, characters etc. These facts may be meaningful or maybe not. after some processing data becomes information.
We can have data without information but cannot have information without data.
rough facts – important and useful definite facts.
Data are individual facts, statistics, or items of information, often numeric, that are collected through observation. In a more technical sense, data are a set of values of qualitative or quantitative variables about one or more persons or objects, while a datum (singular of data) is a single value of a single variable.
source – en.wikipedia.org
To organizing or managing this data we need the data structures. to organize this data the storage system of computer comes to help us, and the data structure is created.
These are the following characterizes of data definition –
- Atomic – It has the single entity of data.
- Traceable – It should be traced or navigated or can be mapped to another element.
- Accurate – Your data definition should be perfect and unambiguous (Integrity).
- Concise & clear – It should be understandable by the users.
What is Data Structure?
The way or method of arranging data on a computer so that it can be accessed and updated efficiently, is data structure.
Data structure is used for processing, retrieving and storing data.
the data structure includes a group of data values, their relation to other elements, and operations that can be carried over the data values.
It can be presented in a simple manner as:
Programs = algorithms + data structures
Data structures = related data + the operations on that data
Classification of Data Structures
Primitive and non-primitive are both type of data structure.
Primitive data structure
It contains basic data types.
Data Type | Represents | Examples |
---|---|---|
integer | whole numbers | -5 , 0 , 123 |
floating point (real) | fractional numbers | -87.5 , 0.0 , 3.14159 |
string | A sequence of characters | "Hello world!" |
Boolean | logical true or false | true , false |
nothing | no data | null |
We are going to read non-primitive data structure mainly.
Non-primitive data type
- Linear Data Type
- Non-Linear Data Type
Linear Data Structure
Data structure in which data elements are arranged sequentially or linearly, where each element is attached to its previous & next elements. linear data structure is a one-dimensional arrangement of elements.
As the elements are stored linearly, the structure supports single-level storage of data. And hence, traversal of the data is achieved through a single run only.
If the size of the data structure increases, the time complexity of the structure increases.
Static Data type – these data type use fixed memory size. static data types are easy to access.
Dynamic Data type – dynamic data types can be updated during runtime.
e.g., Array, Linked lists, Stack, Queue, Hash tables
Non – Linear Data Structure
This type of data structure does not follow the rule of linearity as called non – linear data structure. multilevel structure of data is present here. data elements are arranged in hierarchical order using vertex and edges. Traversing through the elements is not possible in one run, multiple runs are required to traverse through all the elements completely. each element can make multiple connections/paths to reach another element.
it is an efficient way to organizing same data type data values while they are not on contiguous locations. it reduces the wastage of space by providing sufficient memory to each element.
Data is stored randomly in the memory so comparably it is difficult to implement.
e.g., trees, graphs, heaps
The Need of Data Structure
- Data Structure modification is easy.
- It requires less time.
- Save storage memory loss.
- easy access to the large database.
Types of Data Types
Built-in Data type
Built-in data types are predefined inside a programming language and has a fixed set of rules for declaration. the particular belonging programming language has built-in support for these data types.
like – integer, character, float (real), etc.
Derived data type
Derived data types are built by combining both primary and built-in data types, they are subset of built-in data types. they can be implemented independently within a language.
like – arrays, linked lists, queue, etc.
must read:
Algorithms Analysis and why it is important? : DSA
How to Do Masters in Computer Science in INDIA? [2022-23]
How to Create Beautiful Info Cards – CSS Tutorial for Beginners
Conclusion
A specific data structure that has been chosen mostly, depends on the number of times the occurrence of the operation which needs to be carried out on the data structure.
- Traversing
- Searching
- Insertion
- Deletion
- Sorting
- Merging
Data Structure vs DBMS
The method of organizing and storing data on a computer storage is data structure and the tool or system that is going to implement that way is DBMS.
DBMS stands for database management system.