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

Notes DS CH 1 Shraddha

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 7

Chapter 1

An Introduction to Data Structures


Topics- "Data, Data types, Data structure, Abstract Data Type (ADT), representation of Information,
characteristics of algorithm, program, analysing programs. Arrays and Hash Tables Concept of
sequential organization, linear and non-linear data structure, storage representation, array
processing sparse matrices, transpose of sparse matrices, Hash Tables, Direct address tables, Hash
tables, Hash functions, Open addressing, Perfect hashing."

Data- 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.

Data Types:
 Primitive Data Types: Basic types provided by a programming language as building
blocks. Examples include integers, floats, characters, and booleans.
 Composite Data Types: Formed by combining primitive types. Examples include
arrays, structures, and classes.
 Abstract Data Types (ADT): Custom data types defined by the user, encapsulating
data and operations. Examples include stacks, queues, lists, and trees

What is Data Structure?

The study of data structure allows us to understand the organization of data and the
management of the data flow in order to increase the efficiency of any process or program.
Data Structure is a particular way of storing and organizing data in the memory of the
computer so that these data can easily be retrieved and efficiently utilized in the future when
required. The data can be managed in various ways, like the logical or mathematical model
for a specific organization of data is known as a data structure.

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
1. Data: We can define data as an elementary value or a collection of values. For
example, the Employee's name and ID are the data related to the Employee.
2. Data Items: A Single unit of value is known as Data Item.
3. Group Items: Data Items that have subordinate data items are known as
Group Items. For example, an employee's name can have a first, middle, and
last name.
4. Elementary Items: Data Items that are unable to divide into sub-items are
known as Elementary Items. For example, the ID of an Employee.
5. Entity and Attribute: A class of certain objects is represented by an Entity. It
consists of different Attributes. Each Attribute symbolizes the specific property
of that Entity. For example,

Attributes ID Name Gender Job Title


Values 1234 Stacey M. Hill Female Software Developer

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. Field: A single elementary unit of information symbolizing the Attribute of an


Entity is known as Field.
2. Record: A collection of different data items are known as a Record. For
example, if we talk about the employee entity, then its name, id, address, and
job title can be grouped to form the record for the employee.
3. File: A collection of different Records of one entity type is known as a File. For
example, if there are 100 employees, there will be 25 records in the related file
containing data about each employee.

Why should we learn Data Structures?


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.

Understanding the Objectives of Data


Structures
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.
Features of Data Structures
1. Robustness: Generally, all computer programmers aim to produce software
that yields correct output for every possible input, along with efficient
execution on all hardware platforms. This type of robust software must
manage both valid and invalid inputs.
2. Adaptability: Building software applications like Web Browsers, Word
Processors, and Internet Search Engine include huge software systems that
require correct and efficient working or execution for many years. Moreover,
software evolves due to emerging technologies or ever-changing market
conditions.
3. Reusability: The features like Reusability and Adaptability go hand in hand. It
is known that the programmer needs many resources to build any software,
making it a costly enterprise. However, if the software is developed in a
reusable and adaptable way, then it can be applied in most future
applications. Thus, by executing quality data structures, it is possible to build
reusable software, which appears to be cost-effective and timesaving.

Data Structure and Abstract Data Type (ADT)

Data Structure:
A data structure is a particular way of organizing data in a computer to utilize it efficiently.
Common data structures include arrays, linked lists, stacks, queues, trees, and graphs.

Abstract Data Type (ADT):


An ADT is a mathematical model for data types where data type is defined by its behavior
(semantics) from the point of view of a user. Examples include:

 Stack ADT: Operations include push, pop, isEmpty, isFull, and peek.
 Queue ADT: Operations include enqueue, dequeue, isEmpty, and isFull.

3. Representation of Information

Information representation involves encoding data in a form that can be processed by a


computer. This can include binary encoding for numbers, character encoding schemes like
ASCII and Unicode, and data formats for structured data like JSON and XML.

4. Characteristics of Algorithms

An algorithm is a finite sequence of well-defined instructions typically used to solve a class


of specific problems or perform a computation. Key characteristics include:

 Finiteness: The algorithm must terminate after a finite number of steps.


 Definiteness: Each step must be precisely defined.
 Input: The algorithm receives input.
 Output: The algorithm produces output.
 Effectiveness: Each step must be basic enough to be performed in principle by a human
using a pen and paper.

5. Program and Analyzing Programs

Program:
A program is a sequence of instructions written to perform a specified task on a computer. It
implements algorithms to solve specific problems.

Analyzing Programs:

 Time Complexity: Measures the amount of time an algorithm takes to complete as a


function of the length of the input.
 Space Complexity: Measures the amount of memory space an algorithm takes to complete
as a function of the length of the input.

Classification of Data Structures

Primitive Data Structures


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

Non-Primitive Data Structures


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

Linear Data Structures


A data structure that preserves a linear connection among its data elements is known
as a Linear Data Structure. The arrangement of the data is done linearly, where each
element consists of the successors and predecessors except the first and the last data
element. However, it is not necessarily true in the case of memory, as the
arrangement may not be sequential.

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy