0% found this document useful (0 votes)
19 views

DS Unit I PPT 1

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)
19 views

DS Unit I PPT 1

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
You are on page 1/ 32

Data Structure

BCA III
Subject Teacher
Seema Pathak
Organizing or structuring data is vital to the
design and implementation of efficient
algorithms and program development. Any
discipline in science and engineering that
requires efficient problem solving using
computers, uses the appropriate data
structures during program development. The
study of data structure is an essential part of
virtually every UG and PG program in
computer science.
1. “Data Structures” , Lipschutz, Schaum’s Outline Series,
Tata Mcgraw-hill Education (India) Pvt. Ltd .
2.“Data Structures Using C and C++”, . Aaron
M.Tenenbaum, PHI Learning Private Limited
3. “Fundamentals of Data Structures”, Horowitz and Sahani,
Galgotia Publications Pvt Ltd
4. “Data Structure Using C”, A.K. Sharma , Pearson
Education
5. “Data structure using C”, E Balaguruswamy, Mcgraw Hill .
6. “Data Structures and Program Design in C”, R. Kruse,
Pearson Education
7. “Data Structures with C”, Reema Thereja, Oxford Press.
Introduction, Basic terminology, Elementary
data organization, Data Structure, Data
structure operation, Algorithms, complexity,
time-space tradeoff, Mathematical notations
and functions, Algorithmic Notation
Data: Data are value or collection of values.
Data are simply collection of facts and
figures.
Data item: A data item refers to a single unit of
value. Data item may be-
Elementary data item: are those that can not be
divided into parts. Ex. ID, age, gender
Composite or group data item: are those that
can be divided into parts. Ex. Name,
address, DOB
Entity: An entity is something that has certain
attributes or properties which may be assigned
some values.
Ex. attribute name Age Gender
value Naresh 25 M
Heena 31 F
Entity Set: An entity set is a set of similar
entities. Ex. Student, Employee
Data can be simply organized in the form of
fields, records and files.

Field: A field is a single elementary unit of


information representing an attribute of an
entity. It contains similar type of information,
Ex. Name, city, color etc.
Record: A record is the collection of related
fields of given entity.

File: A file is the collection of records of the


entities in a given entity set.
Bid Title Author Price

11 Franklin forgets Bourgeois 7.00

22 Arthur and the Seventh-Inning Stretcher Krensky 14.00

33 Midnight Wrestlers Morgan 11.00

44 Midnight Pilot Morgan 9.00

55 Book of Science Activities 18.00


 Data structure is the study of
organization of data and information in
computer memory.
 Data structure is the representation of
logical relationship between existing
data elements.
 The logical or mathematical model of
particular organization of data is called
data structure.
The choice of a particular data model depends
on two considerations:

i) it must be rich enough in structure to


mirror the actual relationship of the data in
the real world.

ii) the structure should be simple enough that


one can effectively process the data.
Data structure are normally divided into
two broad categories:
 Primitive Data Structure

 Non-Primitive Data Structure


Data structure

Primitive DS Non-Primitive DS

Integer Float Character Pointer


Non-Primitive DS

Linear List Non-Linear List

Array Queue Graph Trees

Link List Stack


 These are basic structures that can not be
divided into parts.
 They contain single value.
 These are directly operated upon by the
machine instructions.
 In general, there are different representation on
different computers.
 Integer, Floating-point number, Character
constants, string constants, pointers etc, fall in
this category.
 These are more sophisticated data structures.
 These are derived from the primitive data
structures.
 The non-primitive data structures emphasize on
structuring of a group of homogeneous (same
type) or heterogeneous (different type) data
items.
 Lists, Stack, Queue, Tree, Graph are example of
non-primitive data structures.
On the basis of linearity
• Linear data structure
• Non linear data structure
On the basis of size
• Static data structure
• Dynamic data structure
On the basis of type of elements
• Homogeneous data structure
• Non homogeneous data structure
 Linear Data Structure: Linear data structures can be constructed

as a continuous arrangement of data elements in the memory. It

can be constructed by using array data type. In the linear Data

Structures the relationship of adjacency is maintained between the

data elements.

 Non-linear Data Structure : Non-linear data structure can be

constructed as a collection of randomly distributed set of data

items joined together by using a special pointer (tag). In non-

linear Data structure the relationship of adjacency is not

maintained between the data items.


 StaticData Structure: Static data structure
are those data structures whose size is
declared when they are created and can not
be changed.
Ex. Integer, float, string, array
 Dynamic Data Structure: Dynamic data
structures are those data structures whose
size can be changed during execution.
Ex: Linked list
 Homogeneous data structure: All the
data elements of homogeneous data
structure are of same data type.
Ex. Array

 Heterogeneous data structure: All the


data elements of heterogeneous data
structure are of different data type.
Ex. Record, tree, graph
The most commonly used operation on data
structure are broadly categorized into
following types:
 Creation
 Insertion
 Traversal
 Deletion
 Search
 Sort
 An array is a linear, static, homogeneous data structure.
 An array is defined as a set of finite number of
homogeneous elements referenced by common name.
 It means an array can contain one type of data only,
either all integer, all float-point number or all character.
 The elements of array will always be stored in the consecutive
(continues) memory location.
 Array is the simplest data structure among all structures.
A[0] A[1] A[2] A[3] A[4]
 A[4]
10 20 12 66 31
 Stack is a linear data structure.
 A stack is an ordered collection of elements
with special feature that deletion and insertion
of elements can be done only from one end
called the top of the stack (TOP)
 Due to this property it is also called as Last In
First Out type of data structure (LIFO).
 When an element is inserted into a stack or
removed from the stack, its base remains fixed
where the top of stack changes.
 The bellow show figure how the operations
take place on a stack:

PUSH POP
 Queue are first in first out type of data structure
(i.e. FIFO)
 In a queue new elements are added to the queue
from one end called REAR end and the element
are always removed from other end called the
FRONT end.
 The bellow show figure how the operations take
place12on a stack:
20 30 40 50

front rear
 A lists (Linear linked list) can be defined as a
collection of variable number of data items.
 Lists are the most commonly used non-
primitive data structures.
 An element of list must contain at least two
fields, one for storing data or information and
other for storing address of next element.
 As you know for storing address we have a
special data structure of list the address must
be pointer type.
Technically each such element is referred to as a node,
therefore a list can be defined as a collection of nodes as
show bellow:

Head

AAA BBB CCC

Information field Pointer field


 A tree can be defined as finite set of data items
(nodes).
 Tree is non-linear type of data structure in
which data items are arranged or stored in a
sorted sequence.
 Tree represent the hierarchical relationship
between various elements.
 The tree structure organizes the data into branches,
which related the information.

root
A

B C

D E F G
 Graph is a mathematical non-linear data
structure capable of representing many kind of
physical structures.
 It has found application in Geography,
Chemistry and Engineering sciences.
 Definition: A graph G(V,E) is a set of vertices
V and a set of edges E.

You might also like