Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
120 views

01 Overview of Data Structure PDF

This document provides an overview of a course on data structures. It introduces basic and advanced data structures like arrays, stacks, queues, lists, trees and graphs. It discusses the algorithms used to manipulate these structures and their applications. The objectives of the course are to understand data structures, their characteristics, basic terminology, categories of algorithms, algorithm analysis and more. Key concepts covered include recursion, sorting, searching, time and space complexity analyses of algorithms.

Uploaded by

Kyle Dandoy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

01 Overview of Data Structure PDF

This document provides an overview of a course on data structures. It introduces basic and advanced data structures like arrays, stacks, queues, lists, trees and graphs. It discusses the algorithms used to manipulate these structures and their applications. The objectives of the course are to understand data structures, their characteristics, basic terminology, categories of algorithms, algorithm analysis and more. Key concepts covered include recursion, sorting, searching, time and space complexity analyses of algorithms.

Uploaded by

Kyle Dandoy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

OVERVIEW

OF DATA
STRUCTUR
E
COURSE
DESCRIPTION

This course introduces the students to the design and


implementation of basic and advanced data structures. Topics
include elementary data structures, (including arrays,
stacks, queues, and lists), advanced data structures
(including trees and graphs), the algorithms used to
manipulate these structures, and their application to
solving practical problems.
DATA STRUCTURE
OBJECTIVES

At the end of this presentation the students must be able to comprehend the

following: 1. Data Structure


2. Characteristics of Data Structure

3. Basic Terminology in Data Structure

4. Algorithms

5. Categories of Algorithms

6. Characteristics of Algorithms

7. Algorithm Analysis

DATA STRUCTURE

is a systematic way to organize data in


order to use it efficiently. Following terms
are the foundation terms of a data
structure
FOUNDATION
TERMS OF DATA
STRUCTURE
Interface - each data
structure has an interface.
Interface represents the
set of operations that a
data structure supports.
An interface only provides
the list of supported
operations, type of
parameters they can
accept and return type of
these operations.
FOUNDATION TERMS
OF DATA
STRUCTURE
Implementation - provides the
internal representation of a
data structure.
-provides the definition of the
algorithms used in the
operations of the data
structure.
CHARACTERISTICS OF A DATA STRUCTURE

1. Correctness − Data structure implementation should


implement its interface correctly.
2. Time Complexity − Running time or the execution time of
operations of data structure must be as small as possible.
3. Space Complexity − Memory usage of a data structure
operation should be as little as possible.
NEED FOR DATA
STRUCTURE
1. Data Search − Consider an inventory of 1
million(106) items of a store. If the
application is to search an item, it has to
search an item in 1 million(106) items
every time slowing down the search. As
data grows, search will become slower.
2. Processor Speed − Processor speed
although being very high, falls limited if the
data grows to billion records.
3. Multiple Requests − As thousands of users
can search data simultaneously on a web
server, even the fast server fails while
searching the data.
EXECUTION TIME CASES

1. Worst Case − This is the scenario where a particular


data structure operation takes maximum time it can take. If an operation's
worst case time is ƒ(n) then this operation will not take more than ƒ(n)
time, where ƒ(n) represents function of n.

2. 2.Average Case − This is the scenario depicting the average execution time
of an operation of a data structure. If an operation takes ƒ(n) time in
execution, then m operations will take mƒ(n) time.
3. Best Case − This is the scenario depicting the least possible execution time of an
operation of a data structure. If an operation takes ƒ(n) time in execution, then
the actual operation may take time as the random number which would be
maximum as ƒ(n).

BASIC TERMINOLOGY
1.Data − Data are values or set of values.

2.Data Item − Data item refers to single unit of values.

3. Group Items − Data items that are divided into sub items
are called as Group Items.
4. Elementary Items − Data items that cannot be divided are
called as Elementary Items.
BASIC TERMINOLOGY
5. Attribute and Entity − An entity is that which contains certain
attributes or properties, which may be assigned values. 6. Entity Set −
Entities of similar attributes form an entity set. 7. Field − is a single
elementary unit of information representing an attribute of an entity.
8. Record − is a collection of field values of a given entity. 9. File − is
a collection of records of the entities in a given entity set.
ALGORITHM
a step-by-step procedure, which
defines a set of instructions to be
executed in a certain order to get the
desired output. Algorithms are
generally created independent of
underlying languages, i.e. an
algorithm can be implemented in
more than one programming
language
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 AN
ALGORITHM
• 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.

ALGORITHM
ANALYSIS
Efficiency of an algorithm can be
analyzed at two different stages, before
implementation and after
implementation. They are the following :
• 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.
computer machine. In this
ALGORITHM analysis, actual statistics like
ANALYSIS running time and space
required, are collected.

A Posteriori Analysis − This is


an empirical analysis of an
algorithm. The selected
algorithm is implemented using
programming language. This is
A POSTERIORI ANALYSIS
then executed on target
✓ Program ✓ Language dependent ✓ Hardware dependent ✓
Watch time and byte

ALGORITHM
COMPLEXITY
• Time Factor − Time is measured
by counting the number of key
operations such as comparisons in
the sorting algorithm.

• Space Factor − Space is


measured by counting the
maximum memory space required
by the algorithm.
TIME COMPLEXITY
◼ Time complexity of an algorithm represents the amount
of time required by the algorithm to run to completion.
Time requirements can be defined as a numerical
function T(n), where T(n) can be measured as the
number of steps, provided each step consumes
constant time.
◼ For example, addition of two n-bit integers takes n
steps. Consequently, the total computational time is
T(n) = c ∗ n, where c is the time taken for the addition
of two bits. Here, we observe that T(n) grows linearly
as the input size increases.

SPACE COMPLEXITY amount of memory space required by the algorithm in


its life cycle. The space required by an algorithm is
equal to the sum of the following two components :
• A fixed part that is a space required to store certain
Space complexity of an algorithm represents the
data and variables, that are independent of the size of Algorithm: SUM(A, B)
the problem. For example, simple variables and Step 1 - START
constants used, program size, etc.
Step 2 - C ← A + B + 10
• A variable part is a space required by variables, whose Step 3 - Stop

size depends on the size of the problem. For example,


dynamic memory allocation, recursion stack space, etc. Space complexity S(P) of any algorithm P is S(P) = C + SP(I),
where C is the fixed part and S(I) is the variable part of the
algorithm, which depends on instance characteristic I
Hence S(P) = 1 + 3
ENABLING ASSESSMENT 1:

Direction: Express your understanding in your own statements, no need to copy the definition cited above, just
explain your answers briefly the way you understand the following concepts:
1. Data Structure

2. Characteristics of Data Structure


3. Basic Terminology in Data Structure

4. Algorithms

5. Categories of Algorithms

6. Characteristics of Algorithms

7. Algorithm Analysis

ENABLING ASSESSMENT 2:

Give the time and space complexity of the following codes:

1. int sum(int x, int y, int z)

{
int ans = x + y + z;

} return ans;

2. int sum(int v[ ], int n) {

int r = 0;
for (int i = 0; i < n; ++i)
{
r += v[i];
}
return r;
}

THANK YOU !!!

You might also like