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

1 Intro

Uploaded by

SmartSheets AI
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)
7 views

1 Intro

Uploaded by

SmartSheets AI
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/ 25

Course Title : Data Structures and Algorithms

Course Code : CS202


Credits : 4

Theory Instructor : Vani M


Objectives of the Course:

• Help you to write efficient programs.


• To help you to understand how to structure information to
support efficient processing.
• To provide knowledge in various data structures and
algorithms.
• To teach how to measure the effectiveness (in terms of
time and space complexities) of various computer
algorithms.
Reference Books

1. Alfred V. Aho, Jeffrey D. Ullman, John E. Hopcroft. Data Structures and


Algorithms. Addison Wesley, 1983.
2. Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein.
Introduction to Algorithms. McGraw-Hill, 2001.
3. Donald Knuth, The Art of Computer Programming, vol. 1. Addison-Wesley,
3rd edition, 1997.
4. Ellis Horowitz, Sartaj Sahni, Sanguthevar Rajasekaran, Fundamentals of
Computer Algorithms (second edition), Universities Press, 2012.
5. D. Samanta, Classic Data structures, Prentice Hall, 2004
Introduction to Data Structure

Vani M.
Data Structures - Introduction

Most fundamental and built-in concept in


computer Science. Good knowledge of data
structure is a must in design and develop efficient
software systems.
The choice of data structure can make the
difference between a program running in a few
seconds or requiring many days.

5
Basic Terminologies
Data Structure:
- Data: are simply a value or a set of values of
different type which is called data types like string,
integer, char, etc.
- Structure: Way of organizing information, so that it
is easier to use.
-In simple words we can define data structures as
● Organizing data in such a way so that data can
be easier to use.
Basic Terminologies

• Data Structure ..
- A data structure is a particular way of organizing
data in a computer so that it can be used efficiently.

- A scheme for organizing related pieces of


information.

7
Why Data Structure

• Human requirement with computer are going to be


complex day by day. To solve the complex
requirements in efficient way we need this study.
• Provide fastest solution for human requirements.
• Provide efficient solution to complex problem.
- Space
-Time

8
Study in Data Structure

• Logical or mathematical description of the


structure.
• Implementation of structure on a computer using
different computer languages ( C, C++, JAVA, pl-
languages etc.)
• Quantitative analysis of the structure, which
includes determining the amount of memory
needed to store the structure and the time required
to process the structure.
9
Classification of Data Structure
Classification of Data Structure ...

• Simple Data Structure: Simple data structure can


be constructed with the help of primitive data
structure. A
primitive data structure used to represent the
standard data
types of any one of the computer languages
(integer,
Character, float etc.).

• Compound
11
Data Structure: Compound data
Classification of Data Structure ...

• Linear Data Structures: A linear data structure


traverses the data elements sequentially, in which
only one data element can directly be reached. Ex:
Arrays, Linked Lists
• Non-Linear Data Structures: Every data item is
attached to several other data items in a way that is
specific for reflecting relationships. The data items
are not arranged in a sequential structure. Ex: Trees,
Graphs
12
Operation on Linear/Non-Linear
Data Structure
• Add an element
• Delete an element
• Traverse / Display
• Sort the list of elements
• Search for a data element

13
Types of Data Structure
• Array: is commonly used in computer programming
to mean a contiguous block of memory locations,
where each memory location stores one fixed-
length data item. e.g. Array of Integers: int a[10],
Array of Character: char b[10]

14
Types of Data Structure ...
Types of Data Structure ...
ked List: Could alternately used to store items. I
• Linked
ed List: Could
list space to alternately
store itemsused to
isstore items. as
created In linked list
is neede
space to store items is created as is needed and destroyed when
destroyed when space no longer required to
space no longer required to store items. Hence linked list is a
stor
ms. dynamic
Hencedata linked list
structure is acquire
space a dynamic
only whendata
need. structur
ce acquire only when need.

15
Types of Data Structure
Types of Data Structure ... ...

Stack: A stack is a data


• Stack: A stack is a data
structure in which items can
structure in which items can be
be inserted only from one
inserted only from one end and
end and get items back from
gettheitems
sameback
end.from
Therethe same
, the last
end.
itemThere , the into
inserted last item
stack, is
inserted
the the into
first stack,
item tois be
thetaken
the
first
outitem
fromtothebe taken
stack. out from
In short
the
its stack. In short
also called its also
Last called
in First
outin
Last [LIFO].
First out [LIFO]. zaid16 shabb
Types of Data Structure ...
Types of Data Structure ...
Queue:
• Queue: A Aqueue
queueisis two
two
ended data structure
ended data structure in in
which items can be
which items can be inserted
nserted from one end and
from one end and taken out
aken out from the other
from the other end.
end. Therefore , the first Therefore,
the inserted
tem first itemintoinserted
queueinto
is
queue
he first isitem
the first
to beitem to be
taken
taken
out fromoutthe from the queue.
queue. This
This property
property is called
is called First First
in in 17
Types of Data Structure ...

• Tree: is a non-linear data structure which is mainly


used to represent data containing a hierarchical
relationship between elements.
• Binary Tree: A binary tree is a tree such that every
node has at most 2 child and each node is labeled
as either left or right child.

18
Typesof
Types ofData
Data Structure
Structure ......

19
Types of Data Structure ...

• Graph: It is a set of items connected by edges. Each


item is called a vertex or node. Trees are just like a
special kinds of graphs. Graphs are usually
represented by G = (V, E), where V is the set vertices
and E is the set of Edges.

20
Types of Data Structure
Types of Data Structure ... ...

Undirected Graph: A graph


Undirected Graph:
whose
A graph
edges
whoseare
edges areunordered
unorderedpair pairofofvertices.
vertices. That
That isis each edgeconnects
each edge
Connects two vertices.In an
two vertices. In an
undirected graph, direction
undirected graph, direction is
is not important, if the path
not
important,is ifavailable,
the path isit available,
can be
it can be traversed
traversedininany anydirection.
direction.
zaid shabbir

21
Types of Data Structure ...

Directed Graph: In directed graph a directional edge


connect two node/vertex. If there is one edge from
one vertex to other then only this path can be
followed.

22
Types
Typesof
ofData
Data Structure
Structure ......

Weighted Graph:AAgraph
Weighted Graph: graphhaving
havinga weight,
a weight,
or or numbe
number
associated witheach
associated with eachedge.
edge

23
Selecting a Data Structure

• Analyze the problem to determine the resource


constraints a solution must meet.
• Determine the basic operations that must be
supported. Quantify the resource constraints for
each operation.
• Select the data structure that best meets these
requirements.

24
Thank you.

25

You might also like