Data Structure Intro
Data Structure Intro
Computer Information, either transmitted or stored. However, there is data that exists in
order types as well. Data can be numbers or texts written on a piece of paper, in the
form of bits and bytes stored inside the memory of electronic devices, or facts stored
within a person's mind. As the world started modernizing, this data became a significant
aspect of everyone's day-to-day life, and various implementations allowed them to store
it differently.
Data is a collection of facts and figures or a set of values or values of a specific format
that refers to a single set of item values. The data items are then classified into sub-
items, which is the group of items that are not known as the simple primary form of the
item.
Let us consider an example where an employee name can be broken down into three
sub-items: First, Middle, and Last. However, an ID assigned to an employee will generally
be considered a single item.
In the example mentioned above, the items such as ID, Age, Gender, First, Middle, Last,
Street, Locality, etc., are elementary data items. In contrast, the Name and the Address
are group data items.
1. First, it must be loaded enough into the structure to reflect the definite
correlation of the data with a real-world object.
2. Second, the formation should be so straightforward that one can adapt to
process the data efficiently whenever necessary.
Some examples of Data Structures are Arrays, Linked Lists, Stack, Queue, Trees, etc. Data
Structures are widely used in almost every aspect of Computer Science, i.e., Compiler
Design, Operating Systems, Graphics, Artificial Intelligence, and many more.
Data Structures are the main part of many Computer Science Algorithms as they allow
the programmers to manage the data in an effective way. It plays a crucial role in
improving the performance of a program or software, as the main objective of the
software is to store and retrieve the user's data as fast as possible.
Basic Terminologies related to Data Structures
Data Structures are the building blocks of any software or program. Selecting the
suitable data structure for a program is an extremely challenging task for a programmer.
The following are some fundamental terminologies used whenever the data structures
are involved:
Entities with similar attributes form an Entity Set. Each attribute of an entity set has a
range of values, the set of all possible values that could be assigned to the specific
attribute.
The term "information" is sometimes utilized for data with given attributes of
meaningful or processed data.
1. Data Structures and Algorithms are two of the key aspects of Computer Science.
2. Data Structures allow us to organize and store data, whereas Algorithms allow us
to process that data meaningfully.
3. Learning Data Structures and Algorithms will help us become better
Programmers.
4. We will be able to write code that is more effective and reliable.
5. We will also be able to solve problems more quickly and efficiently.
1. Correctness: Data Structures are designed to operate correctly for all kinds of
inputs based on the domain of interest. In order words, correctness forms the
primary objective of Data Structure, which always depends upon the problems
that the Data Structure is meant to solve.
2. Efficiency: Data Structures also requires to be efficient. It should process the data
quickly without utilizing many computer resources like memory space. In a real-
time state, the efficiency of a data structure is a key factor in determining the
success and failure of the process.
1. Primitive Data Structures are the data structures consisting of the numbers and
the characters that come in-built into programs.
2. These data structures can be manipulated or operated directly by machine-level
instructions.
3. Basic data types like Integer, Float, Character, and Boolean come under the
Primitive Data Structures.
4. These data types are also called Simple data types, as they contain characters
that can't be divided further
1. Non-Primitive Data Structures are those data structures derived from Primitive
Data Structures.
2. These data structures can't be manipulated or operated directly by machine-level
instructions.
3. The focus of these data structures is on forming a set of data elements that is
either homogeneous (same data type) or heterogeneous (different data types).
4. Based on the structure and arrangement of data, we can divide these data
structures into two sub-categories -
a. Linear Data Structures
b. Non-Linear Data Structures
Based on memory allocation, the Linear Data Structures are further classified into two
types:
1. Static Data Structures: The data structures having a fixed size are known as
Static Data Structures. The memory for these data structures is allocated at the
compiler time, and their size cannot be changed by the user after being
compiled; however, the data stored in them can be altered.
The Array is the best example of the Static Data Structure as they have a fixed
size, and its data can be modified later.
2. Dynamic Data Structures: The data structures having a dynamic size are known
as Dynamic Data Structures. The memory of these data structures is allocated at
the run time, and their size varies during the run time of the code. Moreover, the
user can change the size as well as the data elements stored in these data
structures at the run time of the code.
Linked Lists, Stacks, and Queues are common examples of dynamic data
structures
1. Arrays
An Array is a data structure used to collect multiple data elements of the same data
type into one variable. Instead of storing multiple values of the same data types in
separate variable names, we could store all of them together into one variable. This
statement doesn't imply that we will have to unite all the values of the same data type in
any program into one array of that data type. But there will often be times when some
specific variables of the same data types are all related to one another in a way
appropriate for an array.
An Array is a list of elements where each element has a unique place in the list. The data
elements of the array share the same variable name; however, each carries a different
index number called a subscript. We can access any data element from the list with the
help of its location in the list. Thus, the key feature of the arrays to understand is that
the data is stored in contiguous memory locations, making it possible for the users to
traverse through the data elements of the array using their respective indexes.
Figure 3. An Array
a. One-Dimensional Array: An Array with only one row of data elements is known
as a One-Dimensional Array. It is stored in ascending storage location.
b. Two-Dimensional Array: An Array consisting of multiple rows and columns of
data elements is called a Two-Dimensional Array. It is also known as a Matrix.
c. Multidimensional Array: We can define Multidimensional Array as an Array of
Arrays. Multidimensional Arrays are not bounded to two indices or two
dimensions as they can include as many indices are per the need.
a. We can store a list of data elements belonging to the same data type.
b. Array acts as an auxiliary storage for other data structures.
c. The array also helps store data elements of a binary tree of the fixed count.
d. Array also acts as a storage of matrices.