Top Banner
Introduction to Data Structures Module: Data Structures with C C3: Protected
17
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dsc  -session01_introduction_to_data_structures_v2_1_.2

Introduction to Data Structures

Module:Data

Structures with C

C3: Protected

Page 2: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved2

Icons Used

Questions

Contacts

Reference

Demonstration

Hands on Exercise

Coding Standards

Test Your Understanding

Tools

A Welcome Break

Page 3: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved3

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.

Page 4: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved4

Introduction to Data Structures: Objectives

Objective:After completing this session, you will be able to:

Define a data structureList the types of data structuresIdentify how to analyze and select data structure for a particular application

Page 5: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved5

Overview

Data type - specification of a set of data and the characteristics for that data.Data structure - actual implementation of the data type.

Examples:ArraysStackQueueLists

Page 6: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved6

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.

Page 7: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved7

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.

Page 8: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved8

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.

Page 9: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved9

Selecting a Data Structure (Contd.)

Selection of an abstract data structure is crucial in the design of efficient algorithmsand in estimating their computational complexity.Selection of concrete data structures is important for efficient implementation of algorithms.

Page 10: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved10

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.

Page 11: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved11

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ΩΘ

Page 12: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved12

Big O Notation (Contd.)

The Big O notation is used to measure:The complexity of algorithmsThe 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.

Page 13: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved13

Questions from participants

Page 14: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved14

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.

Page 15: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved15

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:

LinearHash tableTreesGraphs

Page 16: Dsc  -session01_introduction_to_data_structures_v2_1_.2

©Copyright 2007, Cognizant Technology Solutions, All Rights Reserved16

Introduction to Data Structures: Source

Fundamentals of Data Structures by Ellis HorowitzData structures through C by G.S. Balujawww.wikipedia.comhttp://www.macs.hw.ac.uk/~alison/ds98/ds98.htmlhttp://www.idevelopment.info/data/Programming/data_structures/overview/Data_Structures_Algorithms_Introduction.shtmlhttp://www.cs.auckland.ac.nz/software/AlgAnim/lists.htmlhttp://students.washington.edu/mukundn/courses/cse490b/overview.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).

Page 17: Dsc  -session01_introduction_to_data_structures_v2_1_.2

You have successfully completed Introduction to Data Structures