0% found this document useful (0 votes)
119 views7 pages

Introduction, Data Types, Built in and User Defined Data Structures

The document provides an overview of data structures, defining them as specialized formats for organizing and managing data efficiently. It classifies data structures into primitive and non-primitive types, as well as linear and non-linear structures, and discusses their advantages, such as efficient storage and easy data processing, alongside disadvantages like complexity for beginners. Additionally, it covers various data types and the distinction between built-in and user-defined data structures in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views7 pages

Introduction, Data Types, Built in and User Defined Data Structures

The document provides an overview of data structures, defining them as specialized formats for organizing and managing data efficiently. It classifies data structures into primitive and non-primitive types, as well as linear and non-linear structures, and discusses their advantages, such as efficient storage and easy data processing, alongside disadvantages like complexity for beginners. Additionally, it covers various data types and the distinction between built-in and user-defined data structures in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

RP Indraprastha Institute of Technology - [RPIIT]

B-Tech 3rd Sem. Subject: Data Structure and Algorithms


By: Vadini, Asst. Professor (CSE)

Introduction to Data Structures

A Data Structure is a specialized format for organizing, processing, retrieving, and storing data. It
provides a means to manage large amounts of data efficiently, such as large databases and internet
indexing services.

Array, Linked List, 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.

Data Structure is not any programming language like C, C++, Java etc. It is set of algorithms that we
can use in any programming language to structure the data in the memory.

Data Structure Classification:


Data Structures can be classified as primitive or non-primitive, and linear or non-linear:

Primitive Data Structure

The Primitive Data Structures are primitive data types. The int, char, float, double, and pointer are the
primitive data structures that can hold a single value.

Non-Primitive Data Structure


These are more complex data structures that use Primitive Data Structures to form their own
structure. They can store collections or sets of data, including arrays, lists, and more sophisticated
structures like trees and graphs. The non-primitive data structure is divided into two types:
o Linear Data Structure
o Non-linear Data Structure

Linear Data Structures: The arrangement of data in a sequential manner is known as a linear data
structure. The data structures used for this purpose are Arrays, Linked list, Stacks, and Queues. In these
data structures, one element is connected to only one another element in a linear form.
Data structures can also be classified as:
Static Data Structure: It is a type of data structure where the size is allocated at the compile time.
Therefore, the maximum size is fixed.
Dynamic Data Structure: It is a type of data structure where the size is allocated at the run time.
Therefore, the maximum size is flexible.
STATIC Memory: Static memory in data structures is a type of memory that stores variables that are
defined outside of functions and allocated during compile-time.

Array

DYNAMIC Memory: Dynamic memory allocation, also known as runtime memory allocation, is the
process of allocating and deallocating memory blocks during a program's execution.

Linked List
Non-linear Data Structures: These store data in a random or non-sequential way, arranged in many-
one, one-many, or many-many dimensions. Examples include graphs and trees.

Why Data Structures are needed?

With increasing complexities in computer algorithms, the amount of data usage is increasing, this can
affect the performance of the application and can create some areas of concern:
• To handle very large data.
• To achieve high-speed processing.
• Data Search: Getting a particular record from database should be quick and
with optimum use of resources.
• Multiple requests: To handle simultaneous requests from multiple users

Major Operations:

The major or the common operations that can be performed on the data structures are:

Searching: We can search for any element in a data structure.

Sorting: We can sort the elements of a data structure either in an ascending or descending order.

Insertion: We can also insert the new element in a data structure.

Updation: We can also update the element, i.e., we can replace the element with another element.

Deletion: We can also perform the delete operation to remove the element from the data structure.
Advantages of Data Structures:
1) Efficient Storage
Data structures provide efficient storage by organizing the data effectively, which facilitates quick
retrieval and maintenance of the data in the system. The memory allocation takes place according to the
data types used in the data structure.
For example, if it is a long integer data type, 8 bytes get allocated to the memory to store it; arrays
allocate memory in a continuous block; linked lists use pointers to allocate memory; and so on. In a
nutshell, data structures facilitate efficient storage of data on disks in a manner that makes it easy to
retrieve the data.
2) Easy Data Processing
Various data structures are used for specific purposes like organizing, processing, retrieving, and storing
data. These structures enable users to access and work with data efficiently. Data structures simplify
data processing and enable faster sorting and searching for specific data within a large data set. The data
structures convert raw data into a machine-readable format and develop algorithms for data processing.
3) Develop Algorithms
Algorithms for data structures help organize and access information in a structured manner. These
algorithms take into account the format of the data as well as any actions that can be performed on it.
Their goal is to find the most efficient way to store and manipulate data within the structure while also
allowing for easy navigation. By utilizing these algorithms, complex issues can be resolved with
efficiency.
4) Reusability of Data
One of the fundamental advantages of data structure is that it offers data reusability. It enables the
creation of data in specific formats, which can then be stored in libraries, allowing different clients to
utilize and access the data as needed. Therefore, data can be reused in multiple ways and purposes. This
makes it easier to create efficient and dynamic algorithms that can be used for different applications.
5) Provide Built-in Functions
Different programming languages offer diverse data structures equipped with a variety of built-in
functions. These functions make the most efficient use of specific databases and enhance data
manipulation capabilities. For example, data structures provide built-in functions, such as search, sort,
filter, and merge, which enable us to manipulate data more effectively.
6) Supports Data Abstraction
The abstract data type in data structures helps support data abstraction. Data abstraction is the process
of hiding internal functions and displaying relevant and basic information. An abstract data type
supports the use of complex data structures with complex functions.
7) Data Structure Selection for Optimal Performance
When dealing with large data sets, the effectiveness of a program heavily relies on the employed data
structure. Hence, selecting the appropriate data structure becomes paramount. For instance, linked lists,
stacks, and queues are commonly utilized to store data in programs.
Linked lists excel at efficient data insertion and deletion, stacks are ideal for temporary data storage,
and queues are well-suited for organizing data in a specific order. Similarly, a tree data structure aids in
the visualization, implementation, and manipulation of hierarchical data sets.
8) Saves Programmer’s Time
Data structures streamline the process of organizing and accessing data, which helps save time.
Developers can access data quickly and efficiently without having to manually search through large
amounts of data by selecting the appropriate data structure for their program.
9) Practical Applications
Data structures have several practical uses, such as dynamic memory allocation, process scheduling,
dictionaries, and file system organization. It enables the allocation and deallocation of memory blocks
as needed during program execution, reducing memory wastage.
10) Increased Data Security
You can implement security features into data structures to ensure data integrity and application
security. By incorporating these features, the data structures can detect tampering, prevent unauthorized
access, and maintain confidentiality. Therefore, integrating data structures with cyber security
frameworks can create a robust defence against cyber-attacks.

Disadvantages of Data Structure


Having discussed the advantages of data structure in detail, let us look at some of its disadvantages:
1) Difficult to Handle for Beginners
Working on simple and complex data structures requires good programming skills and experience. A
new developer may find it difficult to handle complex data structures.
2) Slower Data Structure Access
Although different data types are available to allocate memory within the system, some of the more
complex data structures’ memory access might become slow and sluggish at times.
3) Initial Quality Testing Takes Time
Building algorithms is a necessary step in the process of designing a data structure from scratch.
Initially, it takes a lot of quality testing time, especially if the complexity of the data structure is high.
4) High Maintenance
Handling large data sets, especially big data, requires the use of complex data structures and algorithms
along with physical infrastructure. This will require a high cost of maintenance for the smooth
functioning of the programs.
5) Requires Comprehensive Planning
Implementing and managing data structures without prior preparation and planning is challenging. You
need sophisticated calculations and tremendous efforts to outline the use of data structures in your
program.
Data Types:
Boolean:
In computer programs, there are three types of data such as numbers, text and booleans. Boolean values
have two possible states such as True or False. In the binary system, the values 0 and 1 are used. Boolean
expressions deal with algebra, logical values and binary variables.
Example: Stores logical values, such as true or false.
Integer:
The integer data type stores both positive numbers and negative numbers along with zero. The integer
data type uses all these integers to maintain precision. All the arithmetic operations can be efficiently
done through integer data types.
Example: Stores whole numbers, such as 1, 2, and 3.
Floating-Point Numbers:
A floating-point data type approximates real values using a formula in order to allow a trade-off between
range and precision. Due to the need for quick processing speeds, systems with extremely small and
very large real numbers are frequently found to use floating-point calculation.
Example: Stores real numbers, such as 3.14 and 1.6e2.
Fixed-Point Numbers:
Binary words are used to store numbers in digital electronics. A fixed-length string of bits (1s and 0s)
is a binary word. The data type determines how these 1s and 0s are interpreted by hardware elements
and software processes.
Example: Stores real numbers as digits to the left and right of the decimal point.
Character:
Character information is stored in a fixed-length field by the CHAR data type. Data can be a string of
letters, integers, and other characters that are supported by the code set of your database locale, whether
they are single-byte or multibyte characters.
Example: Stores a single character, such as 'a' or '1'.
Pointers:
Blocks of memory that are dynamically allocated are managed and stored using pointers. Data objects
or arrays of objects are stored in such alliances. The heap or free store, which is a memory space
provided by the majority of structured and object-oriented languages, is where objects are dynamically
allocated.
Example: Stores a reference to another value in memory.
String:
A string data type consists of a series of characters, either in the form of a literal constant or a variable.
The latter can either be constant in length or allow its elements to alter (after creation). An array data
structure of bytes (or words) is frequently used to create a string, which is typically thought of as a sort
of data and contains a succession of items, typically characters, using some kind of character encoding.
Example: Stores a sequence of characters, such as "Hello, world!".
Built in and User Defined Data Structures:

Build-in Data Structure makes the programming easier and helps the programmer to use them to
obtain a faster solution.
Data Types which cannot be further divided.
e.g. DDMMYY is in the datatype fixed format.

User-Defined Data Structures are data structures that can be programmed to reflect functionality that
isn't supported by a particular programming language.
Here are some examples of user-defined data structures in different programming languages:
Python: User-defined data structures can be programmed using Python concepts to reflect functionality
that isn't supported by Python. Examples include hash maps, lists, sets, and dictionaries.
C: The struct keyword is used to define user-defined data types that group items of different types into
a single type.
C++: A class is a user-defined data type that consists of member variables and member functions. To
access these, an object of the class must usually be created.

You might also like