More Related Content
Similar to Dsc -session01_introduction_to_data_structures_v2_1_.2
Similar to Dsc -session01_introduction_to_data_structures_v2_1_.2 (20)
Dsc -session01_introduction_to_data_structures_v2_1_.2
- 1. Module:
Data
Structures
with C
Introduction to Data Structures
C3: Protected
- 2. Icons Used
Hands on
Questions Tools Exercise
Coding Test Your
Reference
Standards Understanding
A Welcome
Demonstration Contacts
Break
2 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 3. Introduction to Data Structures:
Overview
Introduction:
The session briefly explains about what a data
structure is, what are the different data structures
available, and how to decide on the data
structure to be used for a particular application.
3 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 4. Introduction to Data Structures:
Objectives
Objective:
After completing this session, you will be able to:
Define a data structure
List the types of data structures
Identify how to analyze and select data structure
for a particular application
4 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 5. Overview
Data type - specification of a set of data and
the characteristics for that data.
Data structure - actual implementation of the
data type.
Examples:
Arrays
Stack
Queue
Lists
5 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 6. Abstract Data Type
Definition - a data type together with the
operations, whose properties are specified
independently of any particular
implementation.
Implementation details are not considered.
The definition can be mathematical or can
be programmed as an interface.
6 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 7. Types of Data Structures
Linear structures:
A data structure is said to be linear if its elements form a
sequence or a linear list.
Hash tables:
A hash table, or a hash map, is a data structure that
associates keys with values.
Trees:
A tree can be viewed as a branching structure with no
loops
Graph:
A graph is a data structure, that consists of a set of nodes
and a set of edges that establish relationships
(connections) between the nodes.
7 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 8. Selecting a Data Structure
Selecting a Data Structure begins from
choice of an appropriate Abstract Data Type
ADT.
Abstract Data Structure: An abstract storage
for data defined in terms of the set of
operations to be performed on the data and
computational complexity for performing
these operations. This is regardless of the
implementation in a concrete data structure.
8 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 9. Selecting a Data Structure
(Contd.)
Selection of an abstract data structure is
crucial in the design of efficient algorithms
and in estimating their computational
complexity.
Selection of concrete data structures is
important for efficient implementation of
algorithms.
9 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 10. Performance Analysis and
Measurements
Space and time complexity:
Space complexity: The amount of main memory needed to
execute a program (space for program and data) till it
produces output.
Time complexity: Total CPU time taken by a program
during execution till it produces output.
Complexity can be classified into the following three
categories.
Best Case:
The minimum CPU time taken by a program.
Worst Case:
The maximum CPU time taken by a program.
Average Case:
The average CPU time taken by a program.
10 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 11. Big O Notation
Big O notation:
A mathematical notation used to describe the
asymptotic behavior of functions.
Used to characterize a function's behavior for
very large / very small inputs in a simple but
rigorous way that enables comparison to other
functions.
Notations:
O
Ω
Θ
11 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 12. Big O Notation (Contd.)
The Big O notation is used to measure:
The complexity of algorithms
The efficiency of algorithms
Used to express an ordering property among
functions.
T(N) – gives the amount of the resource
(usually time or the count of some specific
operation) consumed when the input to the
algorithm is of size N.
12 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 14. Test Your Understanding
1. What is the difference between a data type
and a data structure?
2. What is the complexity of the following
program?
Calculation of average mark of the students in a
class.
14 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 15. Introduction to Data Structures:
Summary
Study of data structure deals with the actual
implementation of the data type and gives a way of
storing data in an efficient manner.
An Abstract Data Type (ADT) is a data type together
with the operations, whose properties are specified
independently of any particular implementation.
The different types of data structure available are:
Linear
Hash table
Trees
Graphs
15 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved
- 16. Introduction to Data Structures:
Source
Fundamentals of Data Structures by Ellis Horowitz
Data structures through C by G.S. Baluja
www.wikipedia.com
http://www.macs.hw.ac.uk/~alison/ds98/ds98.html
http://www.idevelopment.info/data/Programming/data_structure
s/overview/Data_Structures_Algorithms_Introduction.shtml
http://www.cs.auckland.ac.nz/software/AlgAnim/lists.html
http://students.washington.edu/mukundn/courses/cse490b/ove
rview.html
Disclaimer: Parts of the content of this course is based on the materials available from the
Web sites and books listed above. The materials that can be accessed from linked sites are
not maintained by Cognizant Academy and we are not responsible for the contents thereof.
All trademarks, service marks, and trade names in this course are the marks of the respective
owner(s).
16 ©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved