0% found this document useful (0 votes)
26 views37 pages

UNIT-1 (1)

The document outlines a Data Structures course (CSE1101) taught by Prateek A. Meshram, covering fundamental concepts, linear and non-linear data structures, and various algorithms. It includes a detailed syllabus with modules on introduction, searching, sorting, linear and non-linear structures, and practical assignments to reinforce programming skills in C. The course aims to equip students with the ability to analyze algorithms and implement various data structures effectively.

Uploaded by

20240802514
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views37 pages

UNIT-1 (1)

The document outlines a Data Structures course (CSE1101) taught by Prateek A. Meshram, covering fundamental concepts, linear and non-linear data structures, and various algorithms. It includes a detailed syllabus with modules on introduction, searching, sorting, linear and non-linear structures, and practical assignments to reinforce programming skills in C. The course aims to equip students with the ability to analyze algorithms and implement various data structures effectively.

Uploaded by

20240802514
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 37

Data Structures

Prateek A. Meshram
Assistant Professor,
Computer Engineering,
DYPIEMR, Akurdi, Pune
Course Structure
Course Code CSE1101

Course Name Data Structures

Credits 5

Pre-Requisites NA

L-T-P-C 3-1-2-5
COURSE OBJECTIVE
• The objective of the course is to introduce the fundamentals of Data
Structures.
• Study and implement various linear data structures- array, stack, queue,
and linked list.
• Study and implement various non-linear data structures- tree and binary
search tree.
• Discuss the working of several searching and sorting algorithms.
Syllabus
Modu Content No.
le No. of
Hour
s
1 MODULE-I: INTRODUCTION 7
Introduction to Data Structures: Concept, Need of Data Structure, Data,
Information, Data type, Data object, ADT and its advantages, Definition of
Data Structure, Primitive operations performed on Data Structures, Types ofData Structures.
Algorithm Analysis:-Complexity of an algorithm, Time and space
Complexity, Classes of a function, Comparison of function, Asymptotic
notations.
2 MODULE-II: SEARCHING AND SORTING 7
Searching- linear search, binary search, sorting- bubble, selection, insertion, merge, quick sort,
performance analysis of searching and sorting.
3 MODULE-III: LINEAR DATA STRUCTURE 8
Linked list- single, double, linked list operations- insert, delete, search, queue- insert, delete, and
stack- push, pop, application of these linear data structures.
4 MODULE-IV: NONLINEAR DATA STRUCTURE: TREE 7
Tree terminologies- all definitions, root, leaf, level, height, depth, types of tree, tree traversal, heap
sort, AVL tree
5 MODULE-V: NONLINEAR DATA STRUCTURE: GRAPH 7
Course Outcomes
On completion of the course the student should be able to
• Analyze step by step and develop algorithms to solve
real-world problems.
• Understanding various searching and sorting techniques.
• Implementing various data structures viz. Stacks, Queues,
Linked Lists.
• Implementing various nonlinear data structures viz tree.
• Implementing various nonlinear data structures viz graph.
LIST OF PRACTICALS:
There will be lab assignments based on data structure concepts to make students
familiar with their programming implementations. These assignments have to be
implemented using C.
1. Recursion, function, Structure: Objective is to make students revise C Programing
Concept.
2. 1D and 2D Arrays: Objective is to make students understand 1D and 2D
representation of arrays and their
usage.
3. Searching and Sorting: Objective is to make students familiar with different searching
and sorting methods
and understand their performance.
4. Linked List: Objective is learn linked list data structure and how to perform operations
on it.
5. Stack: Objective is to make students understand various operations of stack such
as push
and pop.
6. Queue: Objective is to learn queue data structure and various operations available
in it.
7. Tree: Objective is to make students understand tree data structure and perform
various
operations on it.
8. Graph: Objective is to make students understand graph data structure and
perform
various operations on it.
Text Book:
• 1. “Fundamentals of Data Structures in C”, Ellis Horowitz and Sartaj Sahni,
Computer Science Press.
• 2. “Data Structures Using C Aaron M. Tanenbaum”, By Aaron M. Tenenbaum
•Reference Book:
• 1. R. Gilberg, B. Forouzan, "Data Structures: A pseudo code approach with
C", Cenage Learning, Learning, ISBN 9788131503140.
• 2. “Algorithms Unlocked” by Thomas H. Cormen
• 3. Data Structures and Algorithms using Python, Rance D. Necaise, John
Wiley and Sons.
MODULE-I: INTRODUCTION
Introduction to Data Structures: Algorithm Analysis:
• Concept, • Complexity of an algorithm,
• Need of Data Structure, • Time and space Complexity,
• Data, Information, Data type, Data • Classes of a function,
object,
• Comparison of function,
• ADT and its advantages,
• Asymptotic notations.
• Definition of Data Structure,
• Primitive operations performed on
Data Structures,
• Types ofData Structures.
Introduction to data and data objects
•Computer : A programmable device that can store, retrieve, and
process data.(Combination of H/w & S/w )
•Hardware : things which we can touch.
•Software : things which we cannt touch.(Can only see)
•Programming: A programming language is a set of commands,
instructions, and other syntax use to create a software program.
•Data : Information in a form a computer can use

•Information : Any knowledge that can be communicated

•Data type : The specification of how information is represented in the


computer as data and the set of operations that can be applied to it
Computer
Introduction to data and data objects
•Data type : The specification of how information is represented in the
computer as data and the set of operations that can be applied to it
Computer

•Computer program : Data type specifications and instructions for


carrying out operations that are used by a computer to solve a problem

•Machine language : The language, made up of binarycoded instructions,


that is used directly by the computer

•Assembly language : A low-level programming language in which a


mnemonic is used to represent each of the machine language instructions
for a particular computer

•Assembler : A program that translates an assembly language program


into machine code
Introduction to data and data objects

•Compiler : A program that translates a program written in a high-level


language into machine codeComputer program

•Source code : Data type specifications and instructions written in


a high-level programming language

•Object code :A machine language version of


source code.
Data Structures
• Data structure is way of collecting as well as organizing data in such way
that various operations can be performed on it in an effective way.
OR
• Data Structure is a way to organized data in such a way that it can be used
efficiently.
OR
• “Data structure is logical or mathematical way of organizing data in
memory.”
OR
• “A data structure is a systematic way of organizing data in a computer so
that it can be used effectively.”
OR
• -Data structure is collection of elements and all possible operations which
are required for those set of elements.
Need of Data Structure:

1. Store huge data 7. Suitable representation of data:


2. Store data in systematic way: 8. Ease of retrieval:
3. Retain logical relationship 9. Operations allowed:
4. Provide various structures 10. Increase efficiency of algorithm:
5. Static and dynamic formats 11. Processor speed
6. Better algorithms
Characteristics of data structures

1. Correctness: Data structure implementation should implement its


interface correctly.
2. Time Complexity: Running time or the execution tie of operations of
data structure must be as small as possible.
3. Space complexity: Memory usage of a data structure operation
should be as small as possible.
Abstract Data Type
ADT :

“Abstract data types are mathematical models of a set


of data values or information that share similar behavior or
qualities and that can be specified and identified independent
of specific implementations. Abstract data types, or ADTs, are
typically used in algorithms.”

Another definition of ADT is ADT is set of D, F and A.


D – domain = Data object
F – function = set of operation which cannot carried out on
data object.
A – axioms= Properties and rule of the operation
Abstract Data Type
Types of data structures/ Classification
• Data structure (DS) is classified into two categories – primitive data structu
and non-primitive data structure.
Types of Data Structure
• Primitives data structure :
“Primitive data structures are those which are
predefined way of storing data by the system. ”
e.g. int, char, float etc

• Non-primitive data structure :


“The data types that are derived from primary data types are
known as non- Primitive data types. These datatype are used to
store group of values.”
e.g. struct, array, linklist, stack, tree , graph etc.
Types of Data Structure
Linear Data Structure :
“Linear data structure traverses the data elements sequentially, in
which only one data element can directly be reached”
Ex: Arrays, Linked Lists, stack, queue.

Non-Linear Data Structure :


“Every data item is attached to several other data items in a way
that is specific for reflecting relationships.”
Ex: Graph , Tree
e.g. struct, array, linklist, stack, tree , graph etc.
Types of Data Structure
Types of Data Structure
• Static data structure :
“A static data structure is an organization or
collection of data in memory that is fixed in size.”
Ex: Arrays

• Dynamic Data Structure :


“ In Dynamic data structure the size of the structure in not
fixed and can be modified during the operations performed on it”
Ex: Linked list
Types of Data Structure
• Persistent data structure :
“A persistent data structure is a data structure that always
preserves the previous version of itself when it is modified..”
Ex: Linked list, tree
• Ephemeral Data Structure :
“ An ephemeral data structure is one of which only one
version is available at a time(it does not preserve previous
version).”
Ex: RAM , Cache memory
Relationship Between data & Data
Structure
• Data is considered as set of facts and figures or data is value of
group of value which is in particular format
• Data structure is method of gathering as well as organizing data
in such manner that several operation can be performed
• Problem is defined as a situation or
condition which need to solve to achieve the goals
• Algorithm is set of ordered instruction which are
written in simple English language.
Algorithms
• DEFINITION :
“An algorithm is defined as a step-by-step procedure or method
for solving a problem by a computer in a finite number of steps.”
From the data structure point of view, following are some
important categories of algorithms −
• Search − Algorithm to search an item in a data structure.
• Sort − Algorithm to sort items in a certain order.
• Insert − Algorithm to insert item in a data structure.
• Update − Algorithm to update an existing item in a data structure.
• Delete − Algorithm to delete an existing item from a data structure.
Characteristics of Algorithms
• Unambiguous − Algorithm should be clear and unambiguous.
Each of its steps (or phases), and their inputs/outputs should be
clear and must lead to only one meaning.
• Input − An algorithm should have 0 or more well-defined inputs.
• Output − An algorithm should have 1 or more well-defined
outputs, and should match the desired output.
• Finiteness − Algorithms must terminate after a finite number of
steps.
• Feasibility − Should be feasible with the available resources.
• Independent − An algorithm should have step-by-step directions,
which should be independent of any programming code.
Example
• Let's try to learn algorithm-writing by using an example.
• Problem − Design an algorithm to add two numbers and display
the result.

• Step 1 − START
• Step 2 − declare three integers a, b & c Step 3 − define values of
a&b
• Step 4 − add values of a & b
• Step 5 − store output of step 4 to c Step 6 − print c
• Step 7 − STOP
ALGORITHM ANALYSIS
• A Priori Analysis − This is a theoretical analysis of an
algorithm. Efficiency of an algorithm is measured by
assuming that all other factors, for example, processor
speed, are constant and have no effect on the
implementation
• A Posterior Analysis − This is an
empirical analysis of an algorithm. The selected
algorithm is implemented using programming language.
This is then executed on target computer machine. In this
analysis, actual statistics like running time and space
required, are collected.
CASES OF ANALYSIS
ALGORITHMS
•There are 3 types
1. Worst case
2. Best case
3. Average case

•Best Case − Minimum time required for program execution.


•Average Case − Average time required for program execution.
•Worst Case − Maximum time required for program execution
Standard measure of efficiency
There are two important complexity measures:
1. Time complexity
2. Space complexity
Time
“Thecomplexity
time which : required for analysis of given problem of
is
particular size is known
Space complexity : as time complexity”
“The amount of computer memory required tp solve the
given problem of particular size is called as space complexity”
•Time efficiency - a measure of amount of time for an
algorithm to execute.

•Space efficiency - a measure of the amount of memory


needed for an algorithm to execute.
Asymptotic notations
•Asymptotic Notations are languages that allow us to
analyze an algorithm's running time by identifying its
behavior as the input size for the algorithm increases. This
is also known as an algorithm's growth rate
•They gives us the ability to answer these
questions.
•Following are the commonly used asymptotic notations
to calculate the running time complexity of an algorithm.
1. Ο Notation
2. Ω Notation
3. θ Notation
BIG – oh NOTATION
•Big Oh Notation:- Ο
•The notation Ο(n) is the formal way to express the upper
bound of an algorithm's running time. It measures the worst
case time complexity or the longest amount of time an
algorithm can possibly take to complete.
Omega NOTATION
•Omega Notation, Ω
•The notation Ω(n) is the formal way to express the lower
bound of an algorithm's running time. It measures the best
case time complexity or the best amount of time an
algorithm can possibly take to comp
Theta NOTATION
•Theta Notation, θ
•The notation θ(n) is the formal way to express both the lower bound
and the upper bound of an algorithm's running time. It is represented as
follows
Common Asymptotic Notation
THANKYO
U

You might also like