SlideShare a Scribd company logo
1 of 36
Download to read offline
Data Structures and
Algorithms
Week 1: Intro to Data Structures and Algorithms
Ferdin Joe John Joseph, PhD
Faculty of Information Technology
Thai-Nichi Institute of Technology, Bangkok
Join our g+ community
Faculty of Information Technology, Thai -
Nichi Institute of Technology
2
https://bit.ly/2skCIK0
DSA 107 – A Road Map
Attendance
(10%)
Mid Exam
(40%)
How GPA
works for
DSA 107?
Final Exam
(50%)
Faculty of Information Technology, Thai -
Nichi Institute of Technology
3
Textbooks
Faculty of Information Technology, Thai -
Nichi Institute of Technology
4
What is Program
• A Set of Instructions
• Data Structures + Algorithms
• Data Structure = A Container stores Data
• Algoirthm = Logic + Control
Lecture series for Semester 2, Data
Science and Analytics
5
Functions of Data Structures
• Add
• Index
• Key
• Position
• Priority
• Search
• Change
• Delete
Lecture series for Semester 2, Data
Science and Analytics
6
Common Data Structures
• Array
• Stack
• Queue
• Linked List
• Tree
• Heap
• Hash Table
• Priority Queue
Lecture series for Semester 2, Data
Science and Analytics
7
How many Algorithms?
• Countless
Lecture series for Semester 2, Data
Science and Analytics
8
Algorithm Strategies
• Greedy
• Divide and Conquer
• Dynamic Programming
• Exhaustive Search
Lecture series for Semester 2, Data
Science and Analytics
9
Which Data Structure or Algorithm is
better?
• Must Meet Requirement
• High Performance
• Low RAM footprint
• Easy to implement
• Encapsulated
Lecture series for Semester 2, Data
Science and Analytics
10
Chapter 1 Basic Concepts
• Overview: System Life Cycle
• Algorithm Specification
• Data Abstraction
• Performance Analysis
• Performance Measurement
Lecture series for Semester 2, Data
Science and Analytics
11
1.1 Overview: system life cycle (1/2)
• Good programmers regard large-scale computer
programs as systems that contain many complex
interacting parts.
• As systems, these programs undergo a
development process called the system life cycle.
Lecture series for Semester 2, Data
Science and Analytics
12
1.1 Overview (2/2)
• We consider this cycle as consisting of
five phases.
• Requirements
• Analysis: bottom-up vs. top-down
• Design: data objects and operations
• Refinement and Coding
• Verification
• Program Proving
• Testing
• Debugging
Lecture series for Semester 2, Data
Science and Analytics
13
1.2 Algorithm Specification
• 1.2.1 Introduction
• An algorithm is a finite set of instructions that accomplishes a
particular task.
• Criteria
• input: zero or more quantities that are externally supplied
• output: at least one quantity is produced
• definiteness: clear and unambiguous
• finiteness: terminate after a finite number of steps
• effectiveness: instruction is basic enough to be carried out
• A program does not have to satisfy the finiteness criteria.
Lecture series for Semester 2, Data
Science and Analytics
14
1.2 Algorithm Specification
• Representation
• A natural language, like English or Chinese.
• A graphic, like flowcharts.
• A computer language, like C++, Java etc.
• Algorithms + Data structures = Programs
• Sequential search vs. Binary search
Lecture series for Semester 2, Data
Science and Analytics
15
1.3 Data abstraction (1/4)
• Data Type
A data type is a collection of objects and a set of
operations that act on those objects.
• For example, the data type int consists of the objects {0, +1, -1,
+2, -2, …, INT_MAX, INT_MIN} and the operations +, -, *, /, and
%.
• The data types of Java
• The basic data types: char, int, float and double etc
• The group data types: array and arraytype data type
• The user-defined types
Lecture series for Semester 2, Data
Science and Analytics
16
1.3 Data abstraction (2/4)
• Abstract Data Type
• An abstract data type(ADT) is a data type
that is organized in such a way that
the specification of the objects and
the operations on the objects is separated from
the representation of the objects and
the implementation of the operations.
• We know what is does, but not necessarily how it will do it.
Lecture series for Semester 2, Data
Science and Analytics
17
1.3 Data abstraction (3/4)
• Specification vs. Implementation
• An ADT is implementation independent
• Operation specification
• function name
• the types of arguments
• the type of the results
• The functions of a data type can be classify into several
categories:
• creator / constructor
• transformers
• observers / reporters
Lecture series for Semester 2, Data
Science and Analytics
18
1.3 Data abstraction (4/4)
• Example [Abstract data type Natural_Number]
::= is defined as
Lecture series for Semester 2, Data
Science and Analytics
19
1.4 Performance analysis (1/4)
• Criteria
• Is it correct?
• Is it readable?
• …
• Performance Analysis (machine independent)
• space complexity: storage requirement
• time complexity: computing time
• Performance Measurement (machine dependent)
Lecture series for Semester 2, Data
Science and Analytics
20
1.4 Performance analysis (2/4)
• 1.4.1 Space Complexity:
S(P)=C+SP(I)
• Fixed Space Requirements (C)
Independent of the characteristics
of the inputs and outputs
• instruction space
• space for simple variables, fixed-size structured variable, constants
• Variable Space Requirements (SP(I))
depend on the instance characteristic I
• number, size, values of inputs and outputs associated with I
• recursive stack space, formal parameters, local variables, return
address
Lecture series for Semester 2, Data
Science and Analytics
21
1.4 Performance analysis (5/4)
• 1.4.2 Time Complexity:
T(P)=C+TP(I)
• The time, T(P), taken by a program, P, is the sum of its
compile time C and its run (or execution) time, TP(I)
• Fixed time requirements
• Compile time (C), independent of instance characteristics
• Variable time requirements
• Run (execution) time TP
• TP(n)=caADD(n)+csSUB(n)+clLDA(n)+cstSTA(n)
Lecture series for Semester 2, Data
Science and Analytics
22
1.4 Performance analysis (6/4)
• A program step is a syntactically or semantically
meaningful program segment whose execution
time is independent of the instance
characteristics.
• Example
(Regard as the same unit machine independent)
• abc = a + b + b * c + (a + b - c) / (a + b) + 4.0
• abc = a + b + c
• Methods to compute the step count
• Introduce variable count into programs
• Tabular method
• Determine the total number of steps contributed by each
statement step per execution × frequency
• add up the contribution of all statements
Lecture series for Semester 2, Data
Science and Analytics
23
Array ADT – Java Implementation
Lecture series for Semester 2, Data
Science and Analytics
24
An Array-Based Implementation
of the ADT List
public class ListArrayBased
implements ListInterface {
private static final int MAX_LIST = 50;
private Object items[];
// an array of list items
private int numItems;
// number of items in list
Lecture series for Semester 2, Data
Science and Analytics
25
An Array-Based Implementation
of the ADT List
public ListArrayBased() {
items = new Object[MAX_LIST];
numItems = 0;
} // end default constructor
Lecture series for Semester 2, Data
Science and Analytics
26
An Array-Based Implementation
of the ADT List
public boolean isEmpty() {
return (numItems == 0);
} // end isEmpty
public int size() {
return numItems;
} // end size
Lecture series for Semester 2, Data
Science and Analytics
27
Insertion into Array
What happens if you want to insert an item at a specified
position in an existing array?
• Write over the current contents at the given index (which might not
be appropriate), or
• The item originally at the given index must be moved up one
position, and all the items after that index must shuffled up
Lecture series for Semester 2, Data
Science and Analytics
28
An Array-Based Implementation
of the ADT List
public void add(int index, Object item)
throws ListException,
ListIndexOutOfBoundsException {
if (numItems >= MAX_LIST) {
throw new ListException("ListException on add:"+
" out of memory");
} // end if
if (index < 1 || index > numItems+1) {
// index out of range
throw new ListIndexOutOfBoundsException(
"ListIndexOutOfBoundsException on add");
} // end if
Lecture series for Semester 2, Data
Science and Analytics
29
An Array-Based Implementation
of the ADT List
// make room for new element by shifting all items at
// positions >= index toward the end of the
// list (no shift if index == numItems+1)
for (int pos = numItems; pos >= index; pos--) {
items[pos] = items[pos-1];
} // end for
// insert new item
items[index-1] = item;
numItems++;
} //end add
Lecture series for Semester 2, Data
Science and Analytics
30
Removal from Arrays
What happens if you want to remove an item from a specified
position in an existing array?
• Leave gaps in the array, i.e. indices that contain no elements, which
in practice, means that the array element has to be given a special
value to indicate that it is “empty”, or
• All the items after the (removed item’s) index must be shuffled
down
Lecture series for Semester 2, Data
Science and Analytics
31
An Array-Based Implementation
of the ADT Listpublic void remove(int index)
throws ListIndexOutOfBoundsException {
if (index >= 1 && index <= numItems) {
// delete item by shifting all items at
// positions > index toward the beginning of the list
// (no shift if index == size)
for (int pos = index+1; pos <= size(); pos++) {
items[pos-2] = items[pos-1];
} // end for
numItems--;
}
else { // index out of range
throw new ListIndexOutOfBoundsException(
"ListIndexOutOfBoundsException on remove");
} // end if
} // end remove Lecture series for Semester 2, Data
Science and Analytics
32
An Array-Based Implementation
of the ADT List
public Object get(int index)
throws ListIndexOutOfBoundsException {
if (index >= 1 && index <= numItems) {
return items[index-1];
}
else { // index out of range
throw new ListIndexOutOfBoundsException(
"ListIndexOutOfBoundsException on get");
} // end if
} // end get
Lecture series for Semester 2, Data
Science and Analytics
33
An Array-Based Implementation -
Summary
• Good things:
• Fast, random access of elements
• Very memory efficient, very little memory is required
other than that needed to store the contents (but see
bellow)
• Bad things:
• Slow deletion and insertion of elements
• Size must be known when the array is created and is
fixed (static)
Lecture series for Semester 2, Data
Science and Analytics
34
Recommended Reading
https://www.quora.com/Does-a-data-scientist-need-
to-know-algorithms-and-data-structures-as-well-as-
a-software-engineer
Lecture series for Semester 2, Data
Science and Analytics
35
Next Week
Linked List ADT
Doubly Linked List
Circular Linked List
Implementation in Java
Lecture series for Semester 2, Data
Science and Analytics
36

More Related Content

What's hot

Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithmsiqbalphy1
 
Data Structure
Data StructureData Structure
Data Structuresheraz1
 
Data structures and algorithm analysis in java
Data structures and algorithm analysis in javaData structures and algorithm analysis in java
Data structures and algorithm analysis in javaMuhammad Aleem Siddiqui
 
Basic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - NotesBasic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - NotesOmprakash Chauhan
 
Stacks in algorithems & data structure
Stacks in algorithems & data structureStacks in algorithems & data structure
Stacks in algorithems & data structurefaran nawaz
 
Wrokflow programming and provenance query model
Wrokflow programming and provenance query model  Wrokflow programming and provenance query model
Wrokflow programming and provenance query model Rayhan Ferdous
 
Lecture 01 Intro to DSA
Lecture 01 Intro to DSALecture 01 Intro to DSA
Lecture 01 Intro to DSANurjahan Nipa
 
Searching techniques with progrms
Searching techniques with progrmsSearching techniques with progrms
Searching techniques with progrmsMisssaxena
 
4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patilwidespreadpromotion
 
Data structure and algorithm using java
Data structure and algorithm using javaData structure and algorithm using java
Data structure and algorithm using javaNarayan Sau
 

What's hot (20)

Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
geekgap.io webinar #1
geekgap.io webinar #1geekgap.io webinar #1
geekgap.io webinar #1
 
Introduction to data structure and algorithms
Introduction to data structure and algorithmsIntroduction to data structure and algorithms
Introduction to data structure and algorithms
 
Data Structure
Data StructureData Structure
Data Structure
 
Data structures and algorithm analysis in java
Data structures and algorithm analysis in javaData structures and algorithm analysis in java
Data structures and algorithm analysis in java
 
Data Structures 6
Data Structures 6Data Structures 6
Data Structures 6
 
Data Structures 8
Data Structures 8Data Structures 8
Data Structures 8
 
Data Structures 7
Data Structures 7Data Structures 7
Data Structures 7
 
Basic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - NotesBasic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - Notes
 
Data Structures & Algorithms
Data Structures & AlgorithmsData Structures & Algorithms
Data Structures & Algorithms
 
Binary Sort
Binary SortBinary Sort
Binary Sort
 
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERINGCOMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
 
Stacks in algorithems & data structure
Stacks in algorithems & data structureStacks in algorithems & data structure
Stacks in algorithems & data structure
 
Storage struct
Storage structStorage struct
Storage struct
 
Wrokflow programming and provenance query model
Wrokflow programming and provenance query model  Wrokflow programming and provenance query model
Wrokflow programming and provenance query model
 
Lecture 01
Lecture 01Lecture 01
Lecture 01
 
Lecture 01 Intro to DSA
Lecture 01 Intro to DSALecture 01 Intro to DSA
Lecture 01 Intro to DSA
 
Searching techniques with progrms
Searching techniques with progrmsSearching techniques with progrms
Searching techniques with progrms
 
4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil
 
Data structure and algorithm using java
Data structure and algorithm using javaData structure and algorithm using java
Data structure and algorithm using java
 

Similar to Week 1 - Data Structures and Algorithms

b,Sc it data structure.pptx
b,Sc it data structure.pptxb,Sc it data structure.pptx
b,Sc it data structure.pptxclassall
 
b,Sc it data structure.pptx
b,Sc it data structure.pptxb,Sc it data structure.pptx
b,Sc it data structure.pptxclassall
 
b,Sc it data structure.ppt
b,Sc it data structure.pptb,Sc it data structure.ppt
b,Sc it data structure.pptclassall
 
BASICS OF DATA STRUCTURE
BASICS OF DATA STRUCTUREBASICS OF DATA STRUCTURE
BASICS OF DATA STRUCTUREVENNILAV6
 
jn;lm;lkm';m';;lmppt of data structure.pdf
jn;lm;lkm';m';;lmppt of data structure.pdfjn;lm;lkm';m';;lmppt of data structure.pdf
jn;lm;lkm';m';;lmppt of data structure.pdfVinayNassa3
 
Data Structure Using C
Data Structure Using CData Structure Using C
Data Structure Using Ccpjcollege
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.pptYonas D. Ebren
 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...DrkhanchanaR
 
Introduction data structure
Introduction data structureIntroduction data structure
Introduction data structureMuhammad Ismail
 
2022-S1-IT2070-Lecture-06-Algorithms.pptx
2022-S1-IT2070-Lecture-06-Algorithms.pptx2022-S1-IT2070-Lecture-06-Algorithms.pptx
2022-S1-IT2070-Lecture-06-Algorithms.pptxpradeepwalter
 
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfComputer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfPranavAnil9
 
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin HuaiA Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin HuaiDatabricks
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm. Abdul salam
 
Updated Lab3.docx
Updated Lab3.docxUpdated Lab3.docx
Updated Lab3.docxAleezaAnjum
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptxKarthickT28
 
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...IJCSEA Journal
 

Similar to Week 1 - Data Structures and Algorithms (20)

b,Sc it data structure.pptx
b,Sc it data structure.pptxb,Sc it data structure.pptx
b,Sc it data structure.pptx
 
b,Sc it data structure.pptx
b,Sc it data structure.pptxb,Sc it data structure.pptx
b,Sc it data structure.pptx
 
b,Sc it data structure.ppt
b,Sc it data structure.pptb,Sc it data structure.ppt
b,Sc it data structure.ppt
 
BASICS OF DATA STRUCTURE
BASICS OF DATA STRUCTUREBASICS OF DATA STRUCTURE
BASICS OF DATA STRUCTURE
 
Iare ds ppt_3
Iare ds ppt_3Iare ds ppt_3
Iare ds ppt_3
 
jn;lm;lkm';m';;lmppt of data structure.pdf
jn;lm;lkm';m';;lmppt of data structure.pdfjn;lm;lkm';m';;lmppt of data structure.pdf
jn;lm;lkm';m';;lmppt of data structure.pdf
 
Sorting_project_2.pdf
Sorting_project_2.pdfSorting_project_2.pdf
Sorting_project_2.pdf
 
Data Structure Using C
Data Structure Using CData Structure Using C
Data Structure Using C
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
 
Introduction data structure
Introduction data structureIntroduction data structure
Introduction data structure
 
2022-S1-IT2070-Lecture-06-Algorithms.pptx
2022-S1-IT2070-Lecture-06-Algorithms.pptx2022-S1-IT2070-Lecture-06-Algorithms.pptx
2022-S1-IT2070-Lecture-06-Algorithms.pptx
 
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfComputer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
 
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin HuaiA Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
 
2 b queues
2 b queues2 b queues
2 b queues
 
00-review.ppt
00-review.ppt00-review.ppt
00-review.ppt
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
 
Updated Lab3.docx
Updated Lab3.docxUpdated Lab3.docx
Updated Lab3.docx
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
 
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
 

More from Ferdin Joe John Joseph PhD

Week 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud ComputingWeek 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud ComputingFerdin Joe John Joseph PhD
 
Week 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud ComputingWeek 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud ComputingFerdin Joe John Joseph PhD
 
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud ComputingFerdin Joe John Joseph PhD
 
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud ComputingFerdin Joe John Joseph PhD
 
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...Ferdin Joe John Joseph PhD
 
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...Ferdin Joe John Joseph PhD
 
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud ComputingWeek 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud ComputingFerdin Joe John Joseph PhD
 
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...Ferdin Joe John Joseph PhD
 
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud ComputingWeek 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud ComputingFerdin Joe John Joseph PhD
 
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud ComputingWeek 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud ComputingFerdin Joe John Joseph PhD
 
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculumSept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculumFerdin Joe John Joseph PhD
 
Transforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approachTransforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approachFerdin Joe John Joseph PhD
 

More from Ferdin Joe John Joseph PhD (20)

Invited Talk DGTiCon 2022
Invited Talk DGTiCon 2022Invited Talk DGTiCon 2022
Invited Talk DGTiCon 2022
 
Week 12: Cloud AI- DSA 441 Cloud Computing
Week 12: Cloud AI- DSA 441 Cloud ComputingWeek 12: Cloud AI- DSA 441 Cloud Computing
Week 12: Cloud AI- DSA 441 Cloud Computing
 
Week 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud ComputingWeek 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud Computing
 
Week 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud ComputingWeek 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud Computing
 
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
 
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
 
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
 
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
 
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud ComputingWeek 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
 
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
 
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud ComputingWeek 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
 
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud ComputingWeek 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
 
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculumSept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
 
Hadoop in Alibaba Cloud
Hadoop in Alibaba CloudHadoop in Alibaba Cloud
Hadoop in Alibaba Cloud
 
Cloud Computing Essentials in Alibaba Cloud
Cloud Computing Essentials in Alibaba CloudCloud Computing Essentials in Alibaba Cloud
Cloud Computing Essentials in Alibaba Cloud
 
Transforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approachTransforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approach
 
Week 11: Programming for Data Analysis
Week 11: Programming for Data AnalysisWeek 11: Programming for Data Analysis
Week 11: Programming for Data Analysis
 
Week 10: Programming for Data Analysis
Week 10: Programming for Data AnalysisWeek 10: Programming for Data Analysis
Week 10: Programming for Data Analysis
 
Week 9: Programming for Data Analysis
Week 9: Programming for Data AnalysisWeek 9: Programming for Data Analysis
Week 9: Programming for Data Analysis
 
Week 8: Programming for Data Analysis
Week 8: Programming for Data AnalysisWeek 8: Programming for Data Analysis
Week 8: Programming for Data Analysis
 

Recently uploaded

Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...gragchanchal546
 
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...HyderabadDolls
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...nirzagarg
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...gajnagarg
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabiaahmedjiabur940
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...nirzagarg
 
Kings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about themKings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about themeitharjee
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...gajnagarg
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numberssuginr1
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteedamy56318795
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubaikojalkojal131
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxchadhar227
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...gajnagarg
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Klinik kandungan
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangeThinkInnovation
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...nirzagarg
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...HyderabadDolls
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...nirzagarg
 

Recently uploaded (20)

Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
 
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
Kings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about themKings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about them
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbers
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 

Week 1 - Data Structures and Algorithms

  • 1. Data Structures and Algorithms Week 1: Intro to Data Structures and Algorithms Ferdin Joe John Joseph, PhD Faculty of Information Technology Thai-Nichi Institute of Technology, Bangkok
  • 2. Join our g+ community Faculty of Information Technology, Thai - Nichi Institute of Technology 2 https://bit.ly/2skCIK0
  • 3. DSA 107 – A Road Map Attendance (10%) Mid Exam (40%) How GPA works for DSA 107? Final Exam (50%) Faculty of Information Technology, Thai - Nichi Institute of Technology 3
  • 4. Textbooks Faculty of Information Technology, Thai - Nichi Institute of Technology 4
  • 5. What is Program • A Set of Instructions • Data Structures + Algorithms • Data Structure = A Container stores Data • Algoirthm = Logic + Control Lecture series for Semester 2, Data Science and Analytics 5
  • 6. Functions of Data Structures • Add • Index • Key • Position • Priority • Search • Change • Delete Lecture series for Semester 2, Data Science and Analytics 6
  • 7. Common Data Structures • Array • Stack • Queue • Linked List • Tree • Heap • Hash Table • Priority Queue Lecture series for Semester 2, Data Science and Analytics 7
  • 8. How many Algorithms? • Countless Lecture series for Semester 2, Data Science and Analytics 8
  • 9. Algorithm Strategies • Greedy • Divide and Conquer • Dynamic Programming • Exhaustive Search Lecture series for Semester 2, Data Science and Analytics 9
  • 10. Which Data Structure or Algorithm is better? • Must Meet Requirement • High Performance • Low RAM footprint • Easy to implement • Encapsulated Lecture series for Semester 2, Data Science and Analytics 10
  • 11. Chapter 1 Basic Concepts • Overview: System Life Cycle • Algorithm Specification • Data Abstraction • Performance Analysis • Performance Measurement Lecture series for Semester 2, Data Science and Analytics 11
  • 12. 1.1 Overview: system life cycle (1/2) • Good programmers regard large-scale computer programs as systems that contain many complex interacting parts. • As systems, these programs undergo a development process called the system life cycle. Lecture series for Semester 2, Data Science and Analytics 12
  • 13. 1.1 Overview (2/2) • We consider this cycle as consisting of five phases. • Requirements • Analysis: bottom-up vs. top-down • Design: data objects and operations • Refinement and Coding • Verification • Program Proving • Testing • Debugging Lecture series for Semester 2, Data Science and Analytics 13
  • 14. 1.2 Algorithm Specification • 1.2.1 Introduction • An algorithm is a finite set of instructions that accomplishes a particular task. • Criteria • input: zero or more quantities that are externally supplied • output: at least one quantity is produced • definiteness: clear and unambiguous • finiteness: terminate after a finite number of steps • effectiveness: instruction is basic enough to be carried out • A program does not have to satisfy the finiteness criteria. Lecture series for Semester 2, Data Science and Analytics 14
  • 15. 1.2 Algorithm Specification • Representation • A natural language, like English or Chinese. • A graphic, like flowcharts. • A computer language, like C++, Java etc. • Algorithms + Data structures = Programs • Sequential search vs. Binary search Lecture series for Semester 2, Data Science and Analytics 15
  • 16. 1.3 Data abstraction (1/4) • Data Type A data type is a collection of objects and a set of operations that act on those objects. • For example, the data type int consists of the objects {0, +1, -1, +2, -2, …, INT_MAX, INT_MIN} and the operations +, -, *, /, and %. • The data types of Java • The basic data types: char, int, float and double etc • The group data types: array and arraytype data type • The user-defined types Lecture series for Semester 2, Data Science and Analytics 16
  • 17. 1.3 Data abstraction (2/4) • Abstract Data Type • An abstract data type(ADT) is a data type that is organized in such a way that the specification of the objects and the operations on the objects is separated from the representation of the objects and the implementation of the operations. • We know what is does, but not necessarily how it will do it. Lecture series for Semester 2, Data Science and Analytics 17
  • 18. 1.3 Data abstraction (3/4) • Specification vs. Implementation • An ADT is implementation independent • Operation specification • function name • the types of arguments • the type of the results • The functions of a data type can be classify into several categories: • creator / constructor • transformers • observers / reporters Lecture series for Semester 2, Data Science and Analytics 18
  • 19. 1.3 Data abstraction (4/4) • Example [Abstract data type Natural_Number] ::= is defined as Lecture series for Semester 2, Data Science and Analytics 19
  • 20. 1.4 Performance analysis (1/4) • Criteria • Is it correct? • Is it readable? • … • Performance Analysis (machine independent) • space complexity: storage requirement • time complexity: computing time • Performance Measurement (machine dependent) Lecture series for Semester 2, Data Science and Analytics 20
  • 21. 1.4 Performance analysis (2/4) • 1.4.1 Space Complexity: S(P)=C+SP(I) • Fixed Space Requirements (C) Independent of the characteristics of the inputs and outputs • instruction space • space for simple variables, fixed-size structured variable, constants • Variable Space Requirements (SP(I)) depend on the instance characteristic I • number, size, values of inputs and outputs associated with I • recursive stack space, formal parameters, local variables, return address Lecture series for Semester 2, Data Science and Analytics 21
  • 22. 1.4 Performance analysis (5/4) • 1.4.2 Time Complexity: T(P)=C+TP(I) • The time, T(P), taken by a program, P, is the sum of its compile time C and its run (or execution) time, TP(I) • Fixed time requirements • Compile time (C), independent of instance characteristics • Variable time requirements • Run (execution) time TP • TP(n)=caADD(n)+csSUB(n)+clLDA(n)+cstSTA(n) Lecture series for Semester 2, Data Science and Analytics 22
  • 23. 1.4 Performance analysis (6/4) • A program step is a syntactically or semantically meaningful program segment whose execution time is independent of the instance characteristics. • Example (Regard as the same unit machine independent) • abc = a + b + b * c + (a + b - c) / (a + b) + 4.0 • abc = a + b + c • Methods to compute the step count • Introduce variable count into programs • Tabular method • Determine the total number of steps contributed by each statement step per execution × frequency • add up the contribution of all statements Lecture series for Semester 2, Data Science and Analytics 23
  • 24. Array ADT – Java Implementation Lecture series for Semester 2, Data Science and Analytics 24
  • 25. An Array-Based Implementation of the ADT List public class ListArrayBased implements ListInterface { private static final int MAX_LIST = 50; private Object items[]; // an array of list items private int numItems; // number of items in list Lecture series for Semester 2, Data Science and Analytics 25
  • 26. An Array-Based Implementation of the ADT List public ListArrayBased() { items = new Object[MAX_LIST]; numItems = 0; } // end default constructor Lecture series for Semester 2, Data Science and Analytics 26
  • 27. An Array-Based Implementation of the ADT List public boolean isEmpty() { return (numItems == 0); } // end isEmpty public int size() { return numItems; } // end size Lecture series for Semester 2, Data Science and Analytics 27
  • 28. Insertion into Array What happens if you want to insert an item at a specified position in an existing array? • Write over the current contents at the given index (which might not be appropriate), or • The item originally at the given index must be moved up one position, and all the items after that index must shuffled up Lecture series for Semester 2, Data Science and Analytics 28
  • 29. An Array-Based Implementation of the ADT List public void add(int index, Object item) throws ListException, ListIndexOutOfBoundsException { if (numItems >= MAX_LIST) { throw new ListException("ListException on add:"+ " out of memory"); } // end if if (index < 1 || index > numItems+1) { // index out of range throw new ListIndexOutOfBoundsException( "ListIndexOutOfBoundsException on add"); } // end if Lecture series for Semester 2, Data Science and Analytics 29
  • 30. An Array-Based Implementation of the ADT List // make room for new element by shifting all items at // positions >= index toward the end of the // list (no shift if index == numItems+1) for (int pos = numItems; pos >= index; pos--) { items[pos] = items[pos-1]; } // end for // insert new item items[index-1] = item; numItems++; } //end add Lecture series for Semester 2, Data Science and Analytics 30
  • 31. Removal from Arrays What happens if you want to remove an item from a specified position in an existing array? • Leave gaps in the array, i.e. indices that contain no elements, which in practice, means that the array element has to be given a special value to indicate that it is “empty”, or • All the items after the (removed item’s) index must be shuffled down Lecture series for Semester 2, Data Science and Analytics 31
  • 32. An Array-Based Implementation of the ADT Listpublic void remove(int index) throws ListIndexOutOfBoundsException { if (index >= 1 && index <= numItems) { // delete item by shifting all items at // positions > index toward the beginning of the list // (no shift if index == size) for (int pos = index+1; pos <= size(); pos++) { items[pos-2] = items[pos-1]; } // end for numItems--; } else { // index out of range throw new ListIndexOutOfBoundsException( "ListIndexOutOfBoundsException on remove"); } // end if } // end remove Lecture series for Semester 2, Data Science and Analytics 32
  • 33. An Array-Based Implementation of the ADT List public Object get(int index) throws ListIndexOutOfBoundsException { if (index >= 1 && index <= numItems) { return items[index-1]; } else { // index out of range throw new ListIndexOutOfBoundsException( "ListIndexOutOfBoundsException on get"); } // end if } // end get Lecture series for Semester 2, Data Science and Analytics 33
  • 34. An Array-Based Implementation - Summary • Good things: • Fast, random access of elements • Very memory efficient, very little memory is required other than that needed to store the contents (but see bellow) • Bad things: • Slow deletion and insertion of elements • Size must be known when the array is created and is fixed (static) Lecture series for Semester 2, Data Science and Analytics 34
  • 36. Next Week Linked List ADT Doubly Linked List Circular Linked List Implementation in Java Lecture series for Semester 2, Data Science and Analytics 36