SlideShare a Scribd company logo
1 of 18
DATA
STRUCTURES
Objectives
At the end of the lesson, the student should be able
to:
 Explain the process of problem solving
 Define data type, abstract data type and data
structure
 Identify the properties of an algorithm
 Differentiate the two addressing methods –
computed addressing and link addressing
 Use the basic mathematical functions to
analyze algorithms
 Measure complexity of algorithms by
expressing the efficiency in terms of time
complexity and big-O notation
Problem Solving Process
 Programming – a problem-solving process which could
be viewed in terms of the following domains:
 Problem domain
▪ input or the raw data to process
▪ output or the processed data
▪ E.g.: sorting of a set of numbers,
▪ raw data: set of numbers in the original order
▪ Processed data: sorted numbers
 Machine domain
▪ storage medium - consists of serially arranged bits that are
addressable as a unit
▪ processing unit - allow us to perform basic operations(i.e.
arithmetic, comparisons)
 Solution domain - links the problem and machine domains
Problem Solving Process
Problem Domain
Problem Solving Process
Machine Domain
Problem Solving Process
Solution Domain
Problem Solving Process
 Two related tasks at the solution domain
 Structuring of higher level data representations
 Synthesis of algorithms
 NOTE: Data Structures and Algorithms are the
building blocks of computer programs
Data Type, Abstract Data Type and
Data Structure
 Data type - kind of data that variables can
assume in a programming language and for
which operations are automatically provided
 Abstract Data Type (ADT) - mathematical
model with defined operations. In Java, an ADT
can be expressed with an interface
Data Type, Abstract Data Type and
Data Structure
public interface Stack{
public int size(); /* returns the size of the stack */
public boolean isEmpty(); /* checks if empty */
public Object top() throws StackException;
public Object pop() throws StackException;
public void push(Object item) throws StackException;
}
 Data structure – the implementation of ADT in
terms of the data types or other data
structures. In Java, a data structure can be
expressed with a class
Algorithm
 Finite set of instructions which, if followed, will
accomplish a task
 Finiteness - an algorithm must terminate after a finite
number of steps
 Definiteness - ensured if every step of an algorithm is
precisely defined
 Input - domain of the algorithm which could be zero or
more quantities
 Output - set of one or more resulting quantities; also
called the range of the algorithm
 Effectiveness - ensured if all the operations in the
algorithm are sufficiently basic that they can, in
principle, be done exactly and in finite time by a person
using paper and pen
Addressing Methods
 Computed Addressing Method - used to access the elements
of a structure in pre-allocated space
int x[10][20];
a = x[4][3];
 Link Addressing Method – used to manipulate dynamic
structures where the size and shape are not known
beforehand or changes at runtime
class Node{
Object info;
Node link;
Node() { }
Node (Object o, Node l){
info = o;
link = l;
}
}
Addressing Methods
 Memory pool or avail list - source of the nodes
from which linked structures are built
class AvailList {
Node head;
AvailList(){
head = null;
}
AvailList(Node n){
head = n;
}
}
Addressing Methods
 Two basic procedures that manipulate the avail list are getNode
and retNode, which requests for a node and returns a node
respectively.
Node getNode(){
Node a;
if ( head == null) {
return null; /* avail list is empty */
} else {
a = head.link; /* assign node to return to a */
head = head.link.link;
return a;
}
}
void retNode(Node n){
n.link = head.link; /* adds the new node at the start of the avail list */
head.link = n;
}
Mathematical Functions
 Floor of x ( ⎣ x ⎦ ) - greatest integer less than or
equal to x, x is any real number
e.g.: ⎣ 3.14 ⎦ = 3
⎣ 1/2 ⎦ = 0
⎣ -1/2 ⎦ = -1
Mathematical Functions
 Ceiling of x ( ⎡ x ⎤ ) - smallest integer greater
than or equal to x, where x is any real number
e.g.: ⎡ 3.14 ⎤ = 4
⎡ 1/2 ⎤ = 1
⎡ -1/2 ⎤ = 0
Mathematical Functions
 Modulo – remainder operator
e.g.: 10 mod 3 = 1
24 mod 8 = 0
-5 mod 7 = -5
Mathematical Functions
 Identities
 ⎡ x ⎤ = ⎣ x ⎦ if and only if x is an integer
 ⎡ x ⎤ = ⎣ x ⎦ + 1 if and only if x is not an integer
 ⎣ - x ⎦ = - ⎡ x ⎤
 ⎣ x ⎦ + ⎣ y ⎦ <= ⎣ x + y⎦
 x = ⎣ x ⎦ + x mod 1
 z ( x mod y ) = zx mod zy
Complexity of Algorithms
 Algorithm Efficiency
 Space utilization - amount of memory required to
store the data
 Time efficiency - amount of time required to
process the data
▪ Execution time - amount of time spent in executing
instructions of a given algorithm. Notation: T(n). Several
factors that affect the execution time include:
▪ input size
▪ Instruction type
▪ machine speed
▪ quality of source code of the algorithm implementation
▪ quality of the machine code generated from the source code
by the compiler

More Related Content

What's hot (20)

17. Trees and Tree Like Structures
17. Trees and Tree Like Structures17. Trees and Tree Like Structures
17. Trees and Tree Like Structures
 
Lec4
Lec4Lec4
Lec4
 
Data Structure: Algorithm and analysis
Data Structure: Algorithm and analysisData Structure: Algorithm and analysis
Data Structure: Algorithm and analysis
 
Week7
Week7Week7
Week7
 
19. algorithms and-complexity
19. algorithms and-complexity19. algorithms and-complexity
19. algorithms and-complexity
 
Lec16
Lec16Lec16
Lec16
 
18. Dictionaries, Hash-Tables and Set
18. Dictionaries, Hash-Tables and Set18. Dictionaries, Hash-Tables and Set
18. Dictionaries, Hash-Tables and Set
 
Arrays
ArraysArrays
Arrays
 
Chapter 9 ds
Chapter 9 dsChapter 9 ds
Chapter 9 ds
 
Lec4
Lec4Lec4
Lec4
 
Monadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query ExpressionsMonadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query Expressions
 
Chapter 4 - Classes in Java
Chapter 4 - Classes in JavaChapter 4 - Classes in Java
Chapter 4 - Classes in Java
 
Chapter 3 Arrays in Java
Chapter 3 Arrays in JavaChapter 3 Arrays in Java
Chapter 3 Arrays in Java
 
algorithm unit 1
algorithm unit 1algorithm unit 1
algorithm unit 1
 
Advance data structure & algorithm
Advance data structure & algorithmAdvance data structure & algorithm
Advance data structure & algorithm
 
Lec5
Lec5Lec5
Lec5
 
Lec1
Lec1Lec1
Lec1
 
19. Java data structures algorithms and complexity
19. Java data structures algorithms and complexity19. Java data structures algorithms and complexity
19. Java data structures algorithms and complexity
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
algorithm Unit 2
algorithm Unit 2 algorithm Unit 2
algorithm Unit 2
 

Viewers also liked

Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questionsrithustutorials
 
Java data structures for principled programmer
Java data structures for principled programmerJava data structures for principled programmer
Java data structures for principled programmerspnr15z
 
201 core java interview questions oo ps interview questions - javatpoint
201 core java interview questions   oo ps interview questions - javatpoint201 core java interview questions   oo ps interview questions - javatpoint
201 core java interview questions oo ps interview questions - javatpointravi tyagi
 
Preview java j2_ee_book
Preview java j2_ee_bookPreview java j2_ee_book
Preview java j2_ee_bookSubhadip Pal
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085saleForce
 
PIN Specification of 8086 Microprocessor
PIN Specification of 8086 MicroprocessorPIN Specification of 8086 Microprocessor
PIN Specification of 8086 MicroprocessorNikhil Kumar
 
Java object oriented programming - OOPS
Java object oriented programming - OOPSJava object oriented programming - OOPS
Java object oriented programming - OOPSrithustutorials
 
Html, xml and java script
Html, xml and java scriptHtml, xml and java script
Html, xml and java scriptRajeev Uppala
 
L7 decision tree & table
L7 decision tree & tableL7 decision tree & table
L7 decision tree & tableNeha Gupta
 
8086 pin diagram description
8086 pin diagram description8086 pin diagram description
8086 pin diagram descriptionAkhil Singal
 
Workday hcm interview questions
Workday hcm interview questionsWorkday hcm interview questions
Workday hcm interview questionsenrollmy training
 
Oracle Fusion v/s Workday
Oracle Fusion v/s WorkdayOracle Fusion v/s Workday
Oracle Fusion v/s WorkdayMayda Barsumyan
 
Instruction set of 8085 Microprocessor By Er. Swapnil Kaware
Instruction set of 8085 Microprocessor By Er. Swapnil KawareInstruction set of 8085 Microprocessor By Er. Swapnil Kaware
Instruction set of 8085 Microprocessor By Er. Swapnil KawareProf. Swapnil V. Kaware
 
Memory Segmentation of 8086
Memory Segmentation of 8086Memory Segmentation of 8086
Memory Segmentation of 8086Nikhil Kumar
 

Viewers also liked (20)

Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
 
Java data structures for principled programmer
Java data structures for principled programmerJava data structures for principled programmer
Java data structures for principled programmer
 
2-4 tree
2-4 tree2-4 tree
2-4 tree
 
2 3 tree
2 3 tree2 3 tree
2 3 tree
 
201 core java interview questions oo ps interview questions - javatpoint
201 core java interview questions   oo ps interview questions - javatpoint201 core java interview questions   oo ps interview questions - javatpoint
201 core java interview questions oo ps interview questions - javatpoint
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Preview java j2_ee_book
Preview java j2_ee_bookPreview java j2_ee_book
Preview java j2_ee_book
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085
 
PIN Specification of 8086 Microprocessor
PIN Specification of 8086 MicroprocessorPIN Specification of 8086 Microprocessor
PIN Specification of 8086 Microprocessor
 
Java object oriented programming - OOPS
Java object oriented programming - OOPSJava object oriented programming - OOPS
Java object oriented programming - OOPS
 
Html, xml and java script
Html, xml and java scriptHtml, xml and java script
Html, xml and java script
 
L7 decision tree & table
L7 decision tree & tableL7 decision tree & table
L7 decision tree & table
 
8086 pin diagram description
8086 pin diagram description8086 pin diagram description
8086 pin diagram description
 
Workday hcm interview questions
Workday hcm interview questionsWorkday hcm interview questions
Workday hcm interview questions
 
Oracle Fusion v/s Workday
Oracle Fusion v/s WorkdayOracle Fusion v/s Workday
Oracle Fusion v/s Workday
 
Instruction set of 8085 Microprocessor By Er. Swapnil Kaware
Instruction set of 8085 Microprocessor By Er. Swapnil KawareInstruction set of 8085 Microprocessor By Er. Swapnil Kaware
Instruction set of 8085 Microprocessor By Er. Swapnil Kaware
 
Java Day-2
Java Day-2Java Day-2
Java Day-2
 
Enum Report
Enum ReportEnum Report
Enum Report
 
Java Day-7
Java Day-7Java Day-7
Java Day-7
 
Memory Segmentation of 8086
Memory Segmentation of 8086Memory Segmentation of 8086
Memory Segmentation of 8086
 

Similar to Advanced data structures slide 1 2

Introduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptxIntroduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptxPJS KUMAR
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialTo Sum It Up
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureRai University
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm. Abdul salam
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureRai University
 
Mca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureMca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureRai University
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues listsJames Wong
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
StacksqueueslistsFraboni Ec
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsTony Nguyen
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsHarry Potter
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsYoung Alista
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxskilljiolms
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxAbhishek Tirkey
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxGauravPandey43518
 
Matlab Functions
Matlab FunctionsMatlab Functions
Matlab FunctionsUmer Azeem
 
R programming slides
R  programming slidesR  programming slides
R programming slidesPankaj Saini
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptxKarthikVijay59
 

Similar to Advanced data structures slide 1 2 (20)

Introduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptxIntroduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptx
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study material
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structure
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structure
 
Mca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureMca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structure
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptx
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
Matlab Functions
Matlab FunctionsMatlab Functions
Matlab Functions
 
R programming slides
R  programming slidesR  programming slides
R programming slides
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptx
 
8.unit-1-fds-2022-23.pptx
8.unit-1-fds-2022-23.pptx8.unit-1-fds-2022-23.pptx
8.unit-1-fds-2022-23.pptx
 

More from jomerson remorosa

ORACLE: Normalization student
ORACLE: Normalization student ORACLE: Normalization student
ORACLE: Normalization student jomerson remorosa
 
ORACLE: Database management system student
ORACLE: Database management system studentORACLE: Database management system student
ORACLE: Database management system studentjomerson remorosa
 
Logic design and switching theory
Logic design and switching theoryLogic design and switching theory
Logic design and switching theoryjomerson remorosa
 
Advanced data structures slide 2 2+
Advanced data structures slide 2 2+Advanced data structures slide 2 2+
Advanced data structures slide 2 2+jomerson remorosa
 

More from jomerson remorosa (6)

XML DTD Validate
XML DTD ValidateXML DTD Validate
XML DTD Validate
 
ORACLE: Normalization student
ORACLE: Normalization student ORACLE: Normalization student
ORACLE: Normalization student
 
ORACLE: Database management system student
ORACLE: Database management system studentORACLE: Database management system student
ORACLE: Database management system student
 
Cisco network 1 1
Cisco network 1 1Cisco network 1 1
Cisco network 1 1
 
Logic design and switching theory
Logic design and switching theoryLogic design and switching theory
Logic design and switching theory
 
Advanced data structures slide 2 2+
Advanced data structures slide 2 2+Advanced data structures slide 2 2+
Advanced data structures slide 2 2+
 

Recently uploaded

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 

Advanced data structures slide 1 2

  • 2. Objectives At the end of the lesson, the student should be able to:  Explain the process of problem solving  Define data type, abstract data type and data structure  Identify the properties of an algorithm  Differentiate the two addressing methods – computed addressing and link addressing  Use the basic mathematical functions to analyze algorithms  Measure complexity of algorithms by expressing the efficiency in terms of time complexity and big-O notation
  • 3. Problem Solving Process  Programming – a problem-solving process which could be viewed in terms of the following domains:  Problem domain ▪ input or the raw data to process ▪ output or the processed data ▪ E.g.: sorting of a set of numbers, ▪ raw data: set of numbers in the original order ▪ Processed data: sorted numbers  Machine domain ▪ storage medium - consists of serially arranged bits that are addressable as a unit ▪ processing unit - allow us to perform basic operations(i.e. arithmetic, comparisons)  Solution domain - links the problem and machine domains
  • 7. Problem Solving Process  Two related tasks at the solution domain  Structuring of higher level data representations  Synthesis of algorithms  NOTE: Data Structures and Algorithms are the building blocks of computer programs
  • 8. Data Type, Abstract Data Type and Data Structure  Data type - kind of data that variables can assume in a programming language and for which operations are automatically provided  Abstract Data Type (ADT) - mathematical model with defined operations. In Java, an ADT can be expressed with an interface
  • 9. Data Type, Abstract Data Type and Data Structure public interface Stack{ public int size(); /* returns the size of the stack */ public boolean isEmpty(); /* checks if empty */ public Object top() throws StackException; public Object pop() throws StackException; public void push(Object item) throws StackException; }  Data structure – the implementation of ADT in terms of the data types or other data structures. In Java, a data structure can be expressed with a class
  • 10. Algorithm  Finite set of instructions which, if followed, will accomplish a task  Finiteness - an algorithm must terminate after a finite number of steps  Definiteness - ensured if every step of an algorithm is precisely defined  Input - domain of the algorithm which could be zero or more quantities  Output - set of one or more resulting quantities; also called the range of the algorithm  Effectiveness - ensured if all the operations in the algorithm are sufficiently basic that they can, in principle, be done exactly and in finite time by a person using paper and pen
  • 11. Addressing Methods  Computed Addressing Method - used to access the elements of a structure in pre-allocated space int x[10][20]; a = x[4][3];  Link Addressing Method – used to manipulate dynamic structures where the size and shape are not known beforehand or changes at runtime class Node{ Object info; Node link; Node() { } Node (Object o, Node l){ info = o; link = l; } }
  • 12. Addressing Methods  Memory pool or avail list - source of the nodes from which linked structures are built class AvailList { Node head; AvailList(){ head = null; } AvailList(Node n){ head = n; } }
  • 13. Addressing Methods  Two basic procedures that manipulate the avail list are getNode and retNode, which requests for a node and returns a node respectively. Node getNode(){ Node a; if ( head == null) { return null; /* avail list is empty */ } else { a = head.link; /* assign node to return to a */ head = head.link.link; return a; } } void retNode(Node n){ n.link = head.link; /* adds the new node at the start of the avail list */ head.link = n; }
  • 14. Mathematical Functions  Floor of x ( ⎣ x ⎦ ) - greatest integer less than or equal to x, x is any real number e.g.: ⎣ 3.14 ⎦ = 3 ⎣ 1/2 ⎦ = 0 ⎣ -1/2 ⎦ = -1
  • 15. Mathematical Functions  Ceiling of x ( ⎡ x ⎤ ) - smallest integer greater than or equal to x, where x is any real number e.g.: ⎡ 3.14 ⎤ = 4 ⎡ 1/2 ⎤ = 1 ⎡ -1/2 ⎤ = 0
  • 16. Mathematical Functions  Modulo – remainder operator e.g.: 10 mod 3 = 1 24 mod 8 = 0 -5 mod 7 = -5
  • 17. Mathematical Functions  Identities  ⎡ x ⎤ = ⎣ x ⎦ if and only if x is an integer  ⎡ x ⎤ = ⎣ x ⎦ + 1 if and only if x is not an integer  ⎣ - x ⎦ = - ⎡ x ⎤  ⎣ x ⎦ + ⎣ y ⎦ <= ⎣ x + y⎦  x = ⎣ x ⎦ + x mod 1  z ( x mod y ) = zx mod zy
  • 18. Complexity of Algorithms  Algorithm Efficiency  Space utilization - amount of memory required to store the data  Time efficiency - amount of time required to process the data ▪ Execution time - amount of time spent in executing instructions of a given algorithm. Notation: T(n). Several factors that affect the execution time include: ▪ input size ▪ Instruction type ▪ machine speed ▪ quality of source code of the algorithm implementation ▪ quality of the machine code generated from the source code by the compiler