SlideShare ist ein Scribd-Unternehmen logo
1 von 78
Downloaden Sie, um offline zu lesen
Data Structures
Abstract Data Types
Andres Mendez-Vazquez
May 6, 2015
1 / 30
Images/cinvestav-
Outline
1 Introduction
Basic Ideas
Abstract Data Types
2 Linear List: An Example of ADT
Basic Deļ¬nition
Operations
3 Generic Java Interface
Abstract Classes Vs Interfaces
2 / 30
Images/cinvestav-
Outline
1 Introduction
Basic Ideas
Abstract Data Types
2 Linear List: An Example of ADT
Basic Deļ¬nition
Operations
3 Generic Java Interface
Abstract Classes Vs Interfaces
3 / 30
Images/cinvestav-
What is a data structure?
Intuition
A data object is a set or collection of instances!!!
Examples
integer = {0, +1, -1, +2, -2, +3, -3, ...}
daysOfWeek = {S,M,T,W,Th,F,Sa}
4 / 30
Images/cinvestav-
What is a data structure?
Intuition
A data object is a set or collection of instances!!!
Examples
integer = {0, +1, -1, +2, -2, +3, -3, ...}
daysOfWeek = {S,M,T,W,Th,F,Sa}
4 / 30
Images/cinvestav-
What is a data structure?
Intuition
A data object is a set or collection of instances!!!
Examples
integer = {0, +1, -1, +2, -2, +3, -3, ...}
daysOfWeek = {S,M,T,W,Th,F,Sa}
4 / 30
Images/cinvestav-
Those instance may be related!!!
Something quite basic
Instances may or may not be related.
Example
myDataObject = {apple, chair, 2, 5.2, red, green, Jack}
Thus
Data Structure ā‰ˆ Data object + relationships that exist among instances
and elements that comprise an instance.
5 / 30
Images/cinvestav-
Those instance may be related!!!
Something quite basic
Instances may or may not be related.
Example
myDataObject = {apple, chair, 2, 5.2, red, green, Jack}
Thus
Data Structure ā‰ˆ Data object + relationships that exist among instances
and elements that comprise an instance.
5 / 30
Images/cinvestav-
Those instance may be related!!!
Something quite basic
Instances may or may not be related.
Example
myDataObject = {apple, chair, 2, 5.2, red, green, Jack}
Thus
Data Structure ā‰ˆ Data object + relationships that exist among instances
and elements that comprise an instance.
5 / 30
Images/cinvestav-
Examples
Among instances of integers
369 < 370
280 + 4 = 284
Thus
The relationships are usually speciļ¬ed by specifying operations on one or
more instances.
Examples
add, subtract, predecessor, multiply
6 / 30
Images/cinvestav-
Examples
Among instances of integers
369 < 370
280 + 4 = 284
Thus
The relationships are usually speciļ¬ed by specifying operations on one or
more instances.
Examples
add, subtract, predecessor, multiply
6 / 30
Images/cinvestav-
Examples
Among instances of integers
369 < 370
280 + 4 = 284
Thus
The relationships are usually speciļ¬ed by specifying operations on one or
more instances.
Examples
add, subtract, predecessor, multiply
6 / 30
Images/cinvestav-
Outline
1 Introduction
Basic Ideas
Abstract Data Types
2 Linear List: An Example of ADT
Basic Deļ¬nition
Operations
3 Generic Java Interface
Abstract Classes Vs Interfaces
7 / 30
Images/cinvestav-
Abstract Data Type
Data Type
A data type such as int or double is a group of values and operations on
those values that is deļ¬ned within a speciļ¬c programming language.
Abstract Data Type
An Abstract Data Type, or ADT, is a speciļ¬cation for a group of values
and the operations on those values that is deļ¬ned conceptually and
independently of any programming language.
Thus
A data structure is an implementation of an ADT within a programming
language.
8 / 30
Images/cinvestav-
Abstract Data Type
Data Type
A data type such as int or double is a group of values and operations on
those values that is deļ¬ned within a speciļ¬c programming language.
Abstract Data Type
An Abstract Data Type, or ADT, is a speciļ¬cation for a group of values
and the operations on those values that is deļ¬ned conceptually and
independently of any programming language.
Thus
A data structure is an implementation of an ADT within a programming
language.
8 / 30
Images/cinvestav-
Abstract Data Type
Data Type
A data type such as int or double is a group of values and operations on
those values that is deļ¬ned within a speciļ¬c programming language.
Abstract Data Type
An Abstract Data Type, or ADT, is a speciļ¬cation for a group of values
and the operations on those values that is deļ¬ned conceptually and
independently of any programming language.
Thus
A data structure is an implementation of an ADT within a programming
language.
8 / 30
Images/cinvestav-
Using Abstract Data Types
Something Notable
An abstract data type is deļ¬ned indirectly, only by the operations that may
be performed on it and by mathematical constraints on the eļ¬€ects (and
possibly cost) of those operations.
Using Abstract Data Types
1 An abstract object may be operated upon by the operations which
deļ¬ne its abstract type.
2 An abstract object may be passed as a parameter to a procedure.
3 An abstract object may be assigned to a variable.
9 / 30
Images/cinvestav-
Using Abstract Data Types
Something Notable
An abstract data type is deļ¬ned indirectly, only by the operations that may
be performed on it and by mathematical constraints on the eļ¬€ects (and
possibly cost) of those operations.
Using Abstract Data Types
1 An abstract object may be operated upon by the operations which
deļ¬ne its abstract type.
2 An abstract object may be passed as a parameter to a procedure.
3 An abstract object may be assigned to a variable.
9 / 30
Images/cinvestav-
Using Abstract Data Types
Something Notable
An abstract data type is deļ¬ned indirectly, only by the operations that may
be performed on it and by mathematical constraints on the eļ¬€ects (and
possibly cost) of those operations.
Using Abstract Data Types
1 An abstract object may be operated upon by the operations which
deļ¬ne its abstract type.
2 An abstract object may be passed as a parameter to a procedure.
3 An abstract object may be assigned to a variable.
9 / 30
Images/cinvestav-
Using Abstract Data Types
Something Notable
An abstract data type is deļ¬ned indirectly, only by the operations that may
be performed on it and by mathematical constraints on the eļ¬€ects (and
possibly cost) of those operations.
Using Abstract Data Types
1 An abstract object may be operated upon by the operations which
deļ¬ne its abstract type.
2 An abstract object may be passed as a parameter to a procedure.
3 An abstract object may be assigned to a variable.
9 / 30
Images/cinvestav-
Using Abstract Data Types
Something Notable
An abstract data type is deļ¬ned indirectly, only by the operations that may
be performed on it and by mathematical constraints on the eļ¬€ects (and
possibly cost) of those operations.
Using Abstract Data Types
1 An abstract object may be operated upon by the operations which
deļ¬ne its abstract type.
2 An abstract object may be passed as a parameter to a procedure.
3 An abstract object may be assigned to a variable.
9 / 30
Images/cinvestav-
For More
We have the following
ā€œPROGRAMMING WITH ABSTRACT DATA TYPESā€ by Barbara Liskov
and Stephen Zilles
10 / 30
Images/cinvestav-
Abstract Data Types: An Example
We will start with
An example using Lists.
Actually in Java
An interface in the Java programming language is an abstract type that is
used to specify an interface (in the generic sense of the term) that classes
must implement.
11 / 30
Images/cinvestav-
Abstract Data Types: An Example
We will start with
An example using Lists.
Actually in Java
An interface in the Java programming language is an abstract type that is
used to specify an interface (in the generic sense of the term) that classes
must implement.
11 / 30
Images/cinvestav-
Outline
1 Introduction
Basic Ideas
Abstract Data Types
2 Linear List: An Example of ADT
Basic Deļ¬nition
Operations
3 Generic Java Interface
Abstract Classes Vs Interfaces
12 / 30
Images/cinvestav-
Linear (or Ordered) Lists
Deļ¬nition
A linear list is a data structure that holds a sequential list of elements.
Instances
They have the following structure, (e0, e1, e1, ..., enāˆ’1)
Properties
Where ei denotes a list element
n ā‰„ 0 is ļ¬nite
List size is n
13 / 30
Images/cinvestav-
Linear (or Ordered) Lists
Deļ¬nition
A linear list is a data structure that holds a sequential list of elements.
Instances
They have the following structure, (e0, e1, e1, ..., enāˆ’1)
Properties
Where ei denotes a list element
n ā‰„ 0 is ļ¬nite
List size is n
13 / 30
Images/cinvestav-
Linear (or Ordered) Lists
Deļ¬nition
A linear list is a data structure that holds a sequential list of elements.
Instances
They have the following structure, (e0, e1, e1, ..., enāˆ’1)
Properties
Where ei denotes a list element
n ā‰„ 0 is ļ¬nite
List size is n
13 / 30
Images/cinvestav-
Linear (or Ordered) Lists
Deļ¬nition
A linear list is a data structure that holds a sequential list of elements.
Instances
They have the following structure, (e0, e1, e1, ..., enāˆ’1)
Properties
Where ei denotes a list element
n ā‰„ 0 is ļ¬nite
List size is n
13 / 30
Images/cinvestav-
What are the relations inside of a Liner List?
Having this
L = (e0, e1, e2, ..., enāˆ’1)
Relationships
e0 is the zeroā€™th (or front) element
enāˆ’1 is the last element
ei immediately precedes ei+1
14 / 30
Images/cinvestav-
What are the relations inside of a Liner List?
Having this
L = (e0, e1, e2, ..., enāˆ’1)
Relationships
e0 is the zeroā€™th (or front) element
enāˆ’1 is the last element
ei immediately precedes ei+1
14 / 30
Images/cinvestav-
What are the relations inside of a Liner List?
Having this
L = (e0, e1, e2, ..., enāˆ’1)
Relationships
e0 is the zeroā€™th (or front) element
enāˆ’1 is the last element
ei immediately precedes ei+1
14 / 30
Images/cinvestav-
What are the relations inside of a Liner List?
Having this
L = (e0, e1, e2, ..., enāˆ’1)
Relationships
e0 is the zeroā€™th (or front) element
enāˆ’1 is the last element
ei immediately precedes ei+1
14 / 30
Images/cinvestav-
Examples
Simple ones
Students in COP3530 = (Jack, Jill, Abe, Henry, Mary, ..., Judy)
Exams in COP3530 = (exam1, exam2, exam3)
Days of Week = (S, M, T, W, Th, F, Sa)
Months = (Jan, Feb, Mar, Apr, ..., Nov, Dec)
15 / 30
Images/cinvestav-
Examples
Simple ones
Students in COP3530 = (Jack, Jill, Abe, Henry, Mary, ..., Judy)
Exams in COP3530 = (exam1, exam2, exam3)
Days of Week = (S, M, T, W, Th, F, Sa)
Months = (Jan, Feb, Mar, Apr, ..., Nov, Dec)
15 / 30
Images/cinvestav-
Examples
Simple ones
Students in COP3530 = (Jack, Jill, Abe, Henry, Mary, ..., Judy)
Exams in COP3530 = (exam1, exam2, exam3)
Days of Week = (S, M, T, W, Th, F, Sa)
Months = (Jan, Feb, Mar, Apr, ..., Nov, Dec)
15 / 30
Images/cinvestav-
Examples
Simple ones
Students in COP3530 = (Jack, Jill, Abe, Henry, Mary, ..., Judy)
Exams in COP3530 = (exam1, exam2, exam3)
Days of Week = (S, M, T, W, Th, F, Sa)
Months = (Jan, Feb, Mar, Apr, ..., Nov, Dec)
15 / 30
Images/cinvestav-
Outline
1 Introduction
Basic Ideas
Abstract Data Types
2 Linear List: An Example of ADT
Basic Deļ¬nition
Operations
3 Generic Java Interface
Abstract Classes Vs Interfaces
16 / 30
Images/cinvestav-
Which operations must be supported?
We need the size of a linear list
Hey, we need to know how many elements the linear list has.
Determine list size for
L = (a, b, c, d, e)
So, we need to have a operation that returns the size
size(L)=5
17 / 30
Images/cinvestav-
Which operations must be supported?
We need the size of a linear list
Hey, we need to know how many elements the linear list has.
Determine list size for
L = (a, b, c, d, e)
So, we need to have a operation that returns the size
size(L)=5
17 / 30
Images/cinvestav-
Which operations must be supported?
We need the size of a linear list
Hey, we need to know how many elements the linear list has.
Determine list size for
L = (a, b, c, d, e)
So, we need to have a operation that returns the size
size(L)=5
17 / 30
Images/cinvestav-
Linear List Operations: get(theIndex)
Get operations
Get element with given index.
For example
L = (a, b, c, d, e)
Thus
get(0) = a
get(2) = c
get(4) = e
get(-1) = error
get(9) = error
18 / 30
Images/cinvestav-
Linear List Operations: get(theIndex)
Get operations
Get element with given index.
For example
L = (a, b, c, d, e)
Thus
get(0) = a
get(2) = c
get(4) = e
get(-1) = error
get(9) = error
18 / 30
Images/cinvestav-
Linear List Operations: get(theIndex)
Get operations
Get element with given index.
For example
L = (a, b, c, d, e)
Thus
get(0) = a
get(2) = c
get(4) = e
get(-1) = error
get(9) = error
18 / 30
Images/cinvestav-
Linear List Operations: get(theIndex)
Get operations
Get element with given index.
For example
L = (a, b, c, d, e)
Thus
get(0) = a
get(2) = c
get(4) = e
get(-1) = error
get(9) = error
18 / 30
Images/cinvestav-
Linear List Operations: get(theIndex)
Get operations
Get element with given index.
For example
L = (a, b, c, d, e)
Thus
get(0) = a
get(2) = c
get(4) = e
get(-1) = error
get(9) = error
18 / 30
Images/cinvestav-
Linear List Operations: get(theIndex)
Get operations
Get element with given index.
For example
L = (a, b, c, d, e)
Thus
get(0) = a
get(2) = c
get(4) = e
get(-1) = error
get(9) = error
18 / 30
Images/cinvestav-
Linear List Operations: get(theIndex)
Get operations
Get element with given index.
For example
L = (a, b, c, d, e)
Thus
get(0) = a
get(2) = c
get(4) = e
get(-1) = error
get(9) = error
18 / 30
Images/cinvestav-
Linear List Operations: indexOf(theElement)
IndexOf operations
Determine the index of an element.
Example
L = (a, b, d, b, a)
Thus
indexOf(d) = 2
indexOf(a) = 0
indexOf(z) = -1
19 / 30
Images/cinvestav-
Linear List Operations: indexOf(theElement)
IndexOf operations
Determine the index of an element.
Example
L = (a, b, d, b, a)
Thus
indexOf(d) = 2
indexOf(a) = 0
indexOf(z) = -1
19 / 30
Images/cinvestav-
Linear List Operations: indexOf(theElement)
IndexOf operations
Determine the index of an element.
Example
L = (a, b, d, b, a)
Thus
indexOf(d) = 2
indexOf(a) = 0
indexOf(z) = -1
19 / 30
Images/cinvestav-
Linear List Operations: indexOf(theElement)
IndexOf operations
Determine the index of an element.
Example
L = (a, b, d, b, a)
Thus
indexOf(d) = 2
indexOf(a) = 0
indexOf(z) = -1
19 / 30
Images/cinvestav-
Linear List Operations: indexOf(theElement)
IndexOf operations
Determine the index of an element.
Example
L = (a, b, d, b, a)
Thus
indexOf(d) = 2
indexOf(a) = 0
indexOf(z) = -1
19 / 30
Images/cinvestav-
Linear List Operations: add(theIndex, theElement)
Deļ¬nition
Add an element so that the new element has a speciļ¬ed index.
If we have
L = (a, b, c, d, e, f , g)
Thus
add(0,h) =ā‡’ L = (h, a, b, c, d, e, f , g)
Thus, index of a, b, c, d, e, f , g increases by 1.
20 / 30
Images/cinvestav-
Linear List Operations: add(theIndex, theElement)
Deļ¬nition
Add an element so that the new element has a speciļ¬ed index.
If we have
L = (a, b, c, d, e, f , g)
Thus
add(0,h) =ā‡’ L = (h, a, b, c, d, e, f , g)
Thus, index of a, b, c, d, e, f , g increases by 1.
20 / 30
Images/cinvestav-
Linear List Operations: add(theIndex, theElement)
Deļ¬nition
Add an element so that the new element has a speciļ¬ed index.
If we have
L = (a, b, c, d, e, f , g)
Thus
add(0,h) =ā‡’ L = (h, a, b, c, d, e, f , g)
Thus, index of a, b, c, d, e, f , g increases by 1.
20 / 30
Images/cinvestav-
Example
add(2,h) using the original L
=ā‡’ L = (a, b, h, c, d, e, f , g)
index of c, d, e, f , g increases by 1
What about out of the bound
add(10,h) =ā‡’ error
add(-6,h) =ā‡’ error
21 / 30
Images/cinvestav-
Example
add(2,h) using the original L
=ā‡’ L = (a, b, h, c, d, e, f , g)
index of c, d, e, f , g increases by 1
What about out of the bound
add(10,h) =ā‡’ error
add(-6,h) =ā‡’ error
21 / 30
Images/cinvestav-
Example
add(2,h) using the original L
=ā‡’ L = (a, b, h, c, d, e, f , g)
index of c, d, e, f , g increases by 1
What about out of the bound
add(10,h) =ā‡’ error
add(-6,h) =ā‡’ error
21 / 30
Images/cinvestav-
Linear List Operations: remove(theIndex)
Deļ¬nition
Remove and return element with given index.
For example
L = (a, b, c, d, e, f , g)
Example
Remove(2) returns c and L becomes (a, b, d, e, f , g)
Index of d, e, f , g decreases by 1
22 / 30
Images/cinvestav-
Linear List Operations: remove(theIndex)
Deļ¬nition
Remove and return element with given index.
For example
L = (a, b, c, d, e, f , g)
Example
Remove(2) returns c and L becomes (a, b, d, e, f , g)
Index of d, e, f , g decreases by 1
22 / 30
Images/cinvestav-
Linear List Operations: remove(theIndex)
Deļ¬nition
Remove and return element with given index.
For example
L = (a, b, c, d, e, f , g)
Example
Remove(2) returns c and L becomes (a, b, d, e, f , g)
Index of d, e, f , g decreases by 1
22 / 30
Images/cinvestav-
What about the Error
For
L = (a, b, c, d, e, f , g)
Thus
remove(-1) =ā‡’ error
remove(20) =ā‡’ error
23 / 30
Images/cinvestav-
What about the Error
For
L = (a, b, c, d, e, f , g)
Thus
remove(-1) =ā‡’ error
remove(20) =ā‡’ error
23 / 30
Images/cinvestav-
The Final Abstract Data Type for Linear List
Linear List
AbstractDataType LinearList
{
instances
ordered ļ¬nite collections of zero or more elements
operations
isEmpty(): return true iļ¬€ the list is empty, false otherwise
size(): return the list size (i.e., number of elements in the list)
get(index): return the element with ā€œindexā€ index
indexOf(x): return the index of the ļ¬rst occurrence of x in the list, return -1
if x is not in the list
remove(index): remove and return the indexth element, elements with higher
index have their index reduced by 1
add(theIndex, x): insert x as the index of th element, elements with
theIndex ā‰„ index have their index increased by 1
output(): output the list elements from left to right
}
24 / 30
Images/cinvestav-
Java Interface
We can implement this idea of Abstract Data Types
Using Java through the generic interface!!!
An interface may include constants and abstract methods (i.e.,
methods for which no implementation is provided).
Example for List
25 / 30
Images/cinvestav-
Java Interface
We can implement this idea of Abstract Data Types
Using Java through the generic interface!!!
An interface may include constants and abstract methods (i.e.,
methods for which no implementation is provided).
Example for List
p u b l i c i n t e r f a c e L i n e a r L i s t <Item>{
p u b l i c boolean isEmpty ( ) ;
p u b l i c i n t s i z e ( ) ;
p u b l i c Item get ( i n t index ) ;
p u b l i c i n t indexOf ( Item myobject ) ;
p u b l i c void add ( i n t index , Item myobject ) ;
p u b l i c Item remove ( i n t index ) ;
p u b l i c S t r i n g t o S t r i n g ( ) ;
}
25 / 30
Images/cinvestav-
Implementing the Java Interface
Using a calss to implement the interface
c l a s s SimpleArrayList <Item> implements
L i n e a r L i s t <Item>{
// code f o r a l l methods must be provided
}
26 / 30
Images/cinvestav-
Outline
1 Introduction
Basic Ideas
Abstract Data Types
2 Linear List: An Example of ADT
Basic Deļ¬nition
Operations
3 Generic Java Interface
Abstract Classes Vs Interfaces
27 / 30
Images/cinvestav-
Abstract Classes Vs Interfaces
However, we have another way to implement ADT
Abstract Classes
Abstract Classes
An abstract class is a special kind of class that cannot be instantiated.
It is a contract that is used to deļ¬ne hierarchies for all subclasses.
Interface
An interface is not a class.
An interface has no implementation.
It only has the deļ¬nition of the methods without the body.
28 / 30
Images/cinvestav-
Abstract Classes Vs Interfaces
However, we have another way to implement ADT
Abstract Classes
Abstract Classes
An abstract class is a special kind of class that cannot be instantiated.
It is a contract that is used to deļ¬ne hierarchies for all subclasses.
Interface
An interface is not a class.
An interface has no implementation.
It only has the deļ¬nition of the methods without the body.
28 / 30
Images/cinvestav-
Abstract Classes Vs Interfaces
However, we have another way to implement ADT
Abstract Classes
Abstract Classes
An abstract class is a special kind of class that cannot be instantiated.
It is a contract that is used to deļ¬ne hierarchies for all subclasses.
Interface
An interface is not a class.
An interface has no implementation.
It only has the deļ¬nition of the methods without the body.
28 / 30
Images/cinvestav-
Abstract Classes Vs Interfaces
However, we have another way to implement ADT
Abstract Classes
Abstract Classes
An abstract class is a special kind of class that cannot be instantiated.
It is a contract that is used to deļ¬ne hierarchies for all subclasses.
Interface
An interface is not a class.
An interface has no implementation.
It only has the deļ¬nition of the methods without the body.
28 / 30
Images/cinvestav-
Abstract Classes Vs Interfaces
However, we have another way to implement ADT
Abstract Classes
Abstract Classes
An abstract class is a special kind of class that cannot be instantiated.
It is a contract that is used to deļ¬ne hierarchies for all subclasses.
Interface
An interface is not a class.
An interface has no implementation.
It only has the deļ¬nition of the methods without the body.
28 / 30
Images/cinvestav-
Abstract Classes Vs Interfaces
However, we have another way to implement ADT
Abstract Classes
Abstract Classes
An abstract class is a special kind of class that cannot be instantiated.
It is a contract that is used to deļ¬ne hierarchies for all subclasses.
Interface
An interface is not a class.
An interface has no implementation.
It only has the deļ¬nition of the methods without the body.
28 / 30
Images/cinvestav-
Important
We have
A Java class may implement as many interfaces as it wants but can extend
at most one class.
This is why
Once you have chosen your design you can enforce the structure using
Abstract Classes!!!
29 / 30
Images/cinvestav-
Important
We have
A Java class may implement as many interfaces as it wants but can extend
at most one class.
This is why
Once you have chosen your design you can enforce the structure using
Abstract Classes!!!
29 / 30
Images/cinvestav-
Example of Abstract Class
Code
p u b l i c a b s t r a c t c l a s s L i n e a r L i s t <Item>{
p u b l i c boolean isEmpty ( ) ;
p u b l i c i n t s i z e ( ) ;
p u b l i c Item get ( i n t index ) ;
p u b l i c i n t indexOf ( Item myobject ) ;
p u b l i c void add ( i n t index , Item myobject ) ;
p u b l i c Item remove ( i n t index ) ;
p u b l i c S t r i n g t o S t r i n g ( ) ;
}
30 / 30

Weitere Ƥhnliche Inhalte

Was ist angesagt?

Data structures
Data structuresData structures
Data structuresnaveeth babu
Ā 
Ł‡ŁŠŲ§ŁƒŁ„ŲØŁŠŲ§Ł†Ų§ŲŖ
Ł‡ŁŠŲ§ŁƒŁ„ŲØŁŠŲ§Ł†Ų§ŲŖŁ‡ŁŠŲ§ŁƒŁ„ŲØŁŠŲ§Ł†Ų§ŲŖ
Ł‡ŁŠŲ§ŁƒŁ„ŲØŁŠŲ§Ł†Ų§ŲŖRafal Edward
Ā 
Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure BasicsShakila Mahjabin
Ā 
Data structures using C
Data structures using CData structures using C
Data structures using CPdr Patnaik
Ā 
Unit 1 LINEAR DATA STRUCTURES
Unit 1  LINEAR DATA STRUCTURESUnit 1  LINEAR DATA STRUCTURES
Unit 1 LINEAR DATA STRUCTURESUsha Mahalingam
Ā 
Stacks, Queues, Binary Search Trees - Lecture 1 - Advanced Data Structures
Stacks, Queues, Binary Search Trees -  Lecture 1 - Advanced Data StructuresStacks, Queues, Binary Search Trees -  Lecture 1 - Advanced Data Structures
Stacks, Queues, Binary Search Trees - Lecture 1 - Advanced Data StructuresAmrinder Arora
Ā 
17. Trees and Tree Like Structures
17. Trees and Tree Like Structures17. Trees and Tree Like Structures
17. Trees and Tree Like StructuresIntro C# Book
Ā 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEshubhamrohiwal6
Ā 
Data Structures (BE)
Data Structures (BE)Data Structures (BE)
Data Structures (BE)PRABHAHARAN429
Ā 
Introduction to data_structure
Introduction to data_structureIntroduction to data_structure
Introduction to data_structureAshim Lamichhane
Ā 
Introduction to data structure by anil dutt
Introduction to data structure by anil duttIntroduction to data structure by anil dutt
Introduction to data structure by anil duttAnil Dutt
Ā 
Unit iv(dsc++)
Unit iv(dsc++)Unit iv(dsc++)
Unit iv(dsc++)Durga Devi
Ā 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithmsiqbalphy1
Ā 
Introduction to Data Structure
Introduction to Data Structure Introduction to Data Structure
Introduction to Data Structure Prof Ansari
Ā 
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
Ā 
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
Ā 

Was ist angesagt? (20)

Data structures
Data structuresData structures
Data structures
Ā 
Ł‡ŁŠŲ§ŁƒŁ„ŲØŁŠŲ§Ł†Ų§ŲŖ
Ł‡ŁŠŲ§ŁƒŁ„ŲØŁŠŲ§Ł†Ų§ŲŖŁ‡ŁŠŲ§ŁƒŁ„ŲØŁŠŲ§Ł†Ų§ŲŖ
Ł‡ŁŠŲ§ŁƒŁ„ŲØŁŠŲ§Ł†Ų§ŲŖ
Ā 
Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
Ā 
Lesson 4 stacks and queues
Lesson 4  stacks and queuesLesson 4  stacks and queues
Lesson 4 stacks and queues
Ā 
Data structures using C
Data structures using CData structures using C
Data structures using C
Ā 
Unit 1 LINEAR DATA STRUCTURES
Unit 1  LINEAR DATA STRUCTURESUnit 1  LINEAR DATA STRUCTURES
Unit 1 LINEAR DATA STRUCTURES
Ā 
Stacks, Queues, Binary Search Trees - Lecture 1 - Advanced Data Structures
Stacks, Queues, Binary Search Trees -  Lecture 1 - Advanced Data StructuresStacks, Queues, Binary Search Trees -  Lecture 1 - Advanced Data Structures
Stacks, Queues, Binary Search Trees - Lecture 1 - Advanced Data Structures
Ā 
17. Trees and Tree Like Structures
17. Trees and Tree Like Structures17. Trees and Tree Like Structures
17. Trees and Tree Like Structures
Ā 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGE
Ā 
Data Structures (BE)
Data Structures (BE)Data Structures (BE)
Data Structures (BE)
Ā 
Introduction to data_structure
Introduction to data_structureIntroduction to data_structure
Introduction to data_structure
Ā 
Data structures using C
Data structures using CData structures using C
Data structures using C
Ā 
Introduction to data structure by anil dutt
Introduction to data structure by anil duttIntroduction to data structure by anil dutt
Introduction to data structure by anil dutt
Ā 
Unit iv(dsc++)
Unit iv(dsc++)Unit iv(dsc++)
Unit iv(dsc++)
Ā 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
Ā 
Introduction to Data Structure
Introduction to Data Structure Introduction to Data Structure
Introduction to Data Structure
Ā 
Arrays
ArraysArrays
Arrays
Ā 
Data structure using c++
Data structure using c++Data structure using c++
Data structure using c++
Ā 
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
Ā 
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
Ā 

Andere mochten auch

Data abstraction the walls
Data abstraction the wallsData abstraction the walls
Data abstraction the wallsHoang Nguyen
Ā 
03 data abstraction
03 data abstraction03 data abstraction
03 data abstractionOpas Kaewtai
Ā 
Slide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaSlide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaVisakh V
Ā 
1. Fundamental Concept - Data Structures using C++ by Varsha Patil
1. Fundamental Concept - Data Structures using C++ by Varsha Patil1. Fundamental Concept - Data Structures using C++ by Varsha Patil
1. Fundamental Concept - Data Structures using C++ by Varsha Patilwidespreadpromotion
Ā 
4.4 Set operations on relations
4.4 Set operations on relations4.4 Set operations on relations
4.4 Set operations on relationsJan Plaza
Ā 
Creating an Abstract Data Type in C++
Creating an Abstract Data Type in C++Creating an Abstract Data Type in C++
Creating an Abstract Data Type in C++Dennis Gajo
Ā 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data typesjigeno
Ā 

Andere mochten auch (13)

Abstract data types
Abstract data typesAbstract data types
Abstract data types
Ā 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
Ā 
Lec3
Lec3Lec3
Lec3
Ā 
Chapter03
Chapter03Chapter03
Chapter03
Ā 
Data abstraction the walls
Data abstraction the wallsData abstraction the walls
Data abstraction the walls
Ā 
Stack in Sata Structure
Stack in Sata StructureStack in Sata Structure
Stack in Sata Structure
Ā 
03 data abstraction
03 data abstraction03 data abstraction
03 data abstraction
Ā 
Slide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaSlide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schema
Ā 
1. Fundamental Concept - Data Structures using C++ by Varsha Patil
1. Fundamental Concept - Data Structures using C++ by Varsha Patil1. Fundamental Concept - Data Structures using C++ by Varsha Patil
1. Fundamental Concept - Data Structures using C++ by Varsha Patil
Ā 
4.4 Set operations on relations
4.4 Set operations on relations4.4 Set operations on relations
4.4 Set operations on relations
Ā 
Creating an Abstract Data Type in C++
Creating an Abstract Data Type in C++Creating an Abstract Data Type in C++
Creating an Abstract Data Type in C++
Ā 
Inpact 2012 presentation
Inpact 2012 presentationInpact 2012 presentation
Inpact 2012 presentation
Ā 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
Ā 

Ƅhnlich wie Preparation Data Structures 03 abstract data_types

An Optimal Approach For Knowledge Protection In Structured Frequent Patterns
An Optimal Approach For Knowledge Protection In Structured Frequent PatternsAn Optimal Approach For Knowledge Protection In Structured Frequent Patterns
An Optimal Approach For Knowledge Protection In Structured Frequent PatternsWaqas Tariq
Ā 
DS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and EngineeringDS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and EngineeringRAJASEKHARV8
Ā 
Data Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesData Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesAmirthaVarshini80
Ā 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptyarotos643
Ā 
Machine Learning - Simple Linear Regression
Machine Learning - Simple Linear RegressionMachine Learning - Simple Linear Regression
Machine Learning - Simple Linear RegressionSiddharth Shrivastava
Ā 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS Adams Sidibe
Ā 
Sv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmSv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmHARINATH REDDY
Ā 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptxrani marri
Ā 
Data-Structure-original-QuantumSupply.pdf
Data-Structure-original-QuantumSupply.pdfData-Structure-original-QuantumSupply.pdf
Data-Structure-original-QuantumSupply.pdflehal93146
Ā 
Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Prosanta Ghosh
Ā 
Data structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdData structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdNimmi Weeraddana
Ā 
16 Linear data structures
16 Linear data structures16 Linear data structures
16 Linear data structuresmaznabili
Ā 
Datastructures using c++
Datastructures using c++Datastructures using c++
Datastructures using c++Gopi Nath
Ā 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductionsirshad17
Ā 
U2_ER_modeling.pptx
U2_ER_modeling.pptxU2_ER_modeling.pptx
U2_ER_modeling.pptxssusera7b660
Ā 

Ƅhnlich wie Preparation Data Structures 03 abstract data_types (20)

An Optimal Approach For Knowledge Protection In Structured Frequent Patterns
An Optimal Approach For Knowledge Protection In Structured Frequent PatternsAn Optimal Approach For Knowledge Protection In Structured Frequent Patterns
An Optimal Approach For Knowledge Protection In Structured Frequent Patterns
Ā 
DS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and EngineeringDS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and Engineering
Ā 
Data Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesData Structures unit I Introduction - data types
Data Structures unit I Introduction - data types
Ā 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
Ā 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
Ā 
1597380885789.ppt
1597380885789.ppt1597380885789.ppt
1597380885789.ppt
Ā 
Machine Learning - Simple Linear Regression
Machine Learning - Simple Linear RegressionMachine Learning - Simple Linear Regression
Machine Learning - Simple Linear Regression
Ā 
DS_PPT.pptx
DS_PPT.pptxDS_PPT.pptx
DS_PPT.pptx
Ā 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS
Ā 
DS_PPT.ppt
DS_PPT.pptDS_PPT.ppt
DS_PPT.ppt
Ā 
Sv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmSv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvm
Ā 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptx
Ā 
Data-Structure-original-QuantumSupply.pdf
Data-Structure-original-QuantumSupply.pdfData-Structure-original-QuantumSupply.pdf
Data-Structure-original-QuantumSupply.pdf
Ā 
Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013
Ā 
Data structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdData structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pd
Ā 
16 Linear data structures
16 Linear data structures16 Linear data structures
16 Linear data structures
Ā 
Datastructures using c++
Datastructures using c++Datastructures using c++
Datastructures using c++
Ā 
Data structures in c#
Data structures in c#Data structures in c#
Data structures in c#
Ā 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
Ā 
U2_ER_modeling.pptx
U2_ER_modeling.pptxU2_ER_modeling.pptx
U2_ER_modeling.pptx
Ā 

Mehr von Andres Mendez-Vazquez

01.04 orthonormal basis_eigen_vectors
01.04 orthonormal basis_eigen_vectors01.04 orthonormal basis_eigen_vectors
01.04 orthonormal basis_eigen_vectorsAndres Mendez-Vazquez
Ā 
01.03 squared matrices_and_other_issues
01.03 squared matrices_and_other_issues01.03 squared matrices_and_other_issues
01.03 squared matrices_and_other_issuesAndres Mendez-Vazquez
Ā 
05 backpropagation automatic_differentiation
05 backpropagation automatic_differentiation05 backpropagation automatic_differentiation
05 backpropagation automatic_differentiationAndres Mendez-Vazquez
Ā 
01 Introduction to Neural Networks and Deep Learning
01 Introduction to Neural Networks and Deep Learning01 Introduction to Neural Networks and Deep Learning
01 Introduction to Neural Networks and Deep LearningAndres Mendez-Vazquez
Ā 
25 introduction reinforcement_learning
25 introduction reinforcement_learning25 introduction reinforcement_learning
25 introduction reinforcement_learningAndres Mendez-Vazquez
Ā 
Neural Networks and Deep Learning Syllabus
Neural Networks and Deep Learning SyllabusNeural Networks and Deep Learning Syllabus
Neural Networks and Deep Learning SyllabusAndres Mendez-Vazquez
Ā 
Introduction to artificial_intelligence_syllabus
Introduction to artificial_intelligence_syllabusIntroduction to artificial_intelligence_syllabus
Introduction to artificial_intelligence_syllabusAndres Mendez-Vazquez
Ā 
Ideas about a Bachelor in Machine Learning/Data Sciences
Ideas about a Bachelor in Machine Learning/Data SciencesIdeas about a Bachelor in Machine Learning/Data Sciences
Ideas about a Bachelor in Machine Learning/Data SciencesAndres Mendez-Vazquez
Ā 
Analysis of Algorithms Syllabus
Analysis of Algorithms  SyllabusAnalysis of Algorithms  Syllabus
Analysis of Algorithms SyllabusAndres Mendez-Vazquez
Ā 
20 k-means, k-center, k-meoids and variations
20 k-means, k-center, k-meoids and variations20 k-means, k-center, k-meoids and variations
20 k-means, k-center, k-meoids and variationsAndres Mendez-Vazquez
Ā 
17 vapnik chervonenkis dimension
17 vapnik chervonenkis dimension17 vapnik chervonenkis dimension
17 vapnik chervonenkis dimensionAndres Mendez-Vazquez
Ā 
A basic introduction to learning
A basic introduction to learningA basic introduction to learning
A basic introduction to learningAndres Mendez-Vazquez
Ā 

Mehr von Andres Mendez-Vazquez (20)

2.03 bayesian estimation
2.03 bayesian estimation2.03 bayesian estimation
2.03 bayesian estimation
Ā 
05 linear transformations
05 linear transformations05 linear transformations
05 linear transformations
Ā 
01.04 orthonormal basis_eigen_vectors
01.04 orthonormal basis_eigen_vectors01.04 orthonormal basis_eigen_vectors
01.04 orthonormal basis_eigen_vectors
Ā 
01.03 squared matrices_and_other_issues
01.03 squared matrices_and_other_issues01.03 squared matrices_and_other_issues
01.03 squared matrices_and_other_issues
Ā 
01.02 linear equations
01.02 linear equations01.02 linear equations
01.02 linear equations
Ā 
01.01 vector spaces
01.01 vector spaces01.01 vector spaces
01.01 vector spaces
Ā 
06 recurrent neural_networks
06 recurrent neural_networks06 recurrent neural_networks
06 recurrent neural_networks
Ā 
05 backpropagation automatic_differentiation
05 backpropagation automatic_differentiation05 backpropagation automatic_differentiation
05 backpropagation automatic_differentiation
Ā 
Zetta global
Zetta globalZetta global
Zetta global
Ā 
01 Introduction to Neural Networks and Deep Learning
01 Introduction to Neural Networks and Deep Learning01 Introduction to Neural Networks and Deep Learning
01 Introduction to Neural Networks and Deep Learning
Ā 
25 introduction reinforcement_learning
25 introduction reinforcement_learning25 introduction reinforcement_learning
25 introduction reinforcement_learning
Ā 
Neural Networks and Deep Learning Syllabus
Neural Networks and Deep Learning SyllabusNeural Networks and Deep Learning Syllabus
Neural Networks and Deep Learning Syllabus
Ā 
Introduction to artificial_intelligence_syllabus
Introduction to artificial_intelligence_syllabusIntroduction to artificial_intelligence_syllabus
Introduction to artificial_intelligence_syllabus
Ā 
Ideas 09 22_2018
Ideas 09 22_2018Ideas 09 22_2018
Ideas 09 22_2018
Ā 
Ideas about a Bachelor in Machine Learning/Data Sciences
Ideas about a Bachelor in Machine Learning/Data SciencesIdeas about a Bachelor in Machine Learning/Data Sciences
Ideas about a Bachelor in Machine Learning/Data Sciences
Ā 
Analysis of Algorithms Syllabus
Analysis of Algorithms  SyllabusAnalysis of Algorithms  Syllabus
Analysis of Algorithms Syllabus
Ā 
20 k-means, k-center, k-meoids and variations
20 k-means, k-center, k-meoids and variations20 k-means, k-center, k-meoids and variations
20 k-means, k-center, k-meoids and variations
Ā 
18.1 combining models
18.1 combining models18.1 combining models
18.1 combining models
Ā 
17 vapnik chervonenkis dimension
17 vapnik chervonenkis dimension17 vapnik chervonenkis dimension
17 vapnik chervonenkis dimension
Ā 
A basic introduction to learning
A basic introduction to learningA basic introduction to learning
A basic introduction to learning
Ā 

KĆ¼rzlich hochgeladen

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
Ā 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
Ā 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
Ā 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
Ā 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
Ā 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
Ā 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
Ā 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
Ā 
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,Virag Sontakke
Ā 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
Ā 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
Ā 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
Ā 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
Ā 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
Ā 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
Ā 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
Ā 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
Ā 

KĆ¼rzlich hochgeladen (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
Ā 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
Ā 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
Ā 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
Ā 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
Ā 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
Ā 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
Ā 
Model Call Girl in Tilak Nagar Delhi reach out to us at šŸ”9953056974šŸ”
Model Call Girl in Tilak Nagar Delhi reach out to us at šŸ”9953056974šŸ”Model Call Girl in Tilak Nagar Delhi reach out to us at šŸ”9953056974šŸ”
Model Call Girl in Tilak Nagar Delhi reach out to us at šŸ”9953056974šŸ”
Ā 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
Ā 
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
Ā 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Ā 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
Ā 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Ā 
Model Call Girl in Bikash Puri Delhi reach out to us at šŸ”9953056974šŸ”
Model Call Girl in Bikash Puri  Delhi reach out to us at šŸ”9953056974šŸ”Model Call Girl in Bikash Puri  Delhi reach out to us at šŸ”9953056974šŸ”
Model Call Girl in Bikash Puri Delhi reach out to us at šŸ”9953056974šŸ”
Ā 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
Ā 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
Ā 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
Ā 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
Ā 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
Ā 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
Ā 

Preparation Data Structures 03 abstract data_types

  • 1. Data Structures Abstract Data Types Andres Mendez-Vazquez May 6, 2015 1 / 30
  • 2. Images/cinvestav- Outline 1 Introduction Basic Ideas Abstract Data Types 2 Linear List: An Example of ADT Basic Deļ¬nition Operations 3 Generic Java Interface Abstract Classes Vs Interfaces 2 / 30
  • 3. Images/cinvestav- Outline 1 Introduction Basic Ideas Abstract Data Types 2 Linear List: An Example of ADT Basic Deļ¬nition Operations 3 Generic Java Interface Abstract Classes Vs Interfaces 3 / 30
  • 4. Images/cinvestav- What is a data structure? Intuition A data object is a set or collection of instances!!! Examples integer = {0, +1, -1, +2, -2, +3, -3, ...} daysOfWeek = {S,M,T,W,Th,F,Sa} 4 / 30
  • 5. Images/cinvestav- What is a data structure? Intuition A data object is a set or collection of instances!!! Examples integer = {0, +1, -1, +2, -2, +3, -3, ...} daysOfWeek = {S,M,T,W,Th,F,Sa} 4 / 30
  • 6. Images/cinvestav- What is a data structure? Intuition A data object is a set or collection of instances!!! Examples integer = {0, +1, -1, +2, -2, +3, -3, ...} daysOfWeek = {S,M,T,W,Th,F,Sa} 4 / 30
  • 7. Images/cinvestav- Those instance may be related!!! Something quite basic Instances may or may not be related. Example myDataObject = {apple, chair, 2, 5.2, red, green, Jack} Thus Data Structure ā‰ˆ Data object + relationships that exist among instances and elements that comprise an instance. 5 / 30
  • 8. Images/cinvestav- Those instance may be related!!! Something quite basic Instances may or may not be related. Example myDataObject = {apple, chair, 2, 5.2, red, green, Jack} Thus Data Structure ā‰ˆ Data object + relationships that exist among instances and elements that comprise an instance. 5 / 30
  • 9. Images/cinvestav- Those instance may be related!!! Something quite basic Instances may or may not be related. Example myDataObject = {apple, chair, 2, 5.2, red, green, Jack} Thus Data Structure ā‰ˆ Data object + relationships that exist among instances and elements that comprise an instance. 5 / 30
  • 10. Images/cinvestav- Examples Among instances of integers 369 < 370 280 + 4 = 284 Thus The relationships are usually speciļ¬ed by specifying operations on one or more instances. Examples add, subtract, predecessor, multiply 6 / 30
  • 11. Images/cinvestav- Examples Among instances of integers 369 < 370 280 + 4 = 284 Thus The relationships are usually speciļ¬ed by specifying operations on one or more instances. Examples add, subtract, predecessor, multiply 6 / 30
  • 12. Images/cinvestav- Examples Among instances of integers 369 < 370 280 + 4 = 284 Thus The relationships are usually speciļ¬ed by specifying operations on one or more instances. Examples add, subtract, predecessor, multiply 6 / 30
  • 13. Images/cinvestav- Outline 1 Introduction Basic Ideas Abstract Data Types 2 Linear List: An Example of ADT Basic Deļ¬nition Operations 3 Generic Java Interface Abstract Classes Vs Interfaces 7 / 30
  • 14. Images/cinvestav- Abstract Data Type Data Type A data type such as int or double is a group of values and operations on those values that is deļ¬ned within a speciļ¬c programming language. Abstract Data Type An Abstract Data Type, or ADT, is a speciļ¬cation for a group of values and the operations on those values that is deļ¬ned conceptually and independently of any programming language. Thus A data structure is an implementation of an ADT within a programming language. 8 / 30
  • 15. Images/cinvestav- Abstract Data Type Data Type A data type such as int or double is a group of values and operations on those values that is deļ¬ned within a speciļ¬c programming language. Abstract Data Type An Abstract Data Type, or ADT, is a speciļ¬cation for a group of values and the operations on those values that is deļ¬ned conceptually and independently of any programming language. Thus A data structure is an implementation of an ADT within a programming language. 8 / 30
  • 16. Images/cinvestav- Abstract Data Type Data Type A data type such as int or double is a group of values and operations on those values that is deļ¬ned within a speciļ¬c programming language. Abstract Data Type An Abstract Data Type, or ADT, is a speciļ¬cation for a group of values and the operations on those values that is deļ¬ned conceptually and independently of any programming language. Thus A data structure is an implementation of an ADT within a programming language. 8 / 30
  • 17. Images/cinvestav- Using Abstract Data Types Something Notable An abstract data type is deļ¬ned indirectly, only by the operations that may be performed on it and by mathematical constraints on the eļ¬€ects (and possibly cost) of those operations. Using Abstract Data Types 1 An abstract object may be operated upon by the operations which deļ¬ne its abstract type. 2 An abstract object may be passed as a parameter to a procedure. 3 An abstract object may be assigned to a variable. 9 / 30
  • 18. Images/cinvestav- Using Abstract Data Types Something Notable An abstract data type is deļ¬ned indirectly, only by the operations that may be performed on it and by mathematical constraints on the eļ¬€ects (and possibly cost) of those operations. Using Abstract Data Types 1 An abstract object may be operated upon by the operations which deļ¬ne its abstract type. 2 An abstract object may be passed as a parameter to a procedure. 3 An abstract object may be assigned to a variable. 9 / 30
  • 19. Images/cinvestav- Using Abstract Data Types Something Notable An abstract data type is deļ¬ned indirectly, only by the operations that may be performed on it and by mathematical constraints on the eļ¬€ects (and possibly cost) of those operations. Using Abstract Data Types 1 An abstract object may be operated upon by the operations which deļ¬ne its abstract type. 2 An abstract object may be passed as a parameter to a procedure. 3 An abstract object may be assigned to a variable. 9 / 30
  • 20. Images/cinvestav- Using Abstract Data Types Something Notable An abstract data type is deļ¬ned indirectly, only by the operations that may be performed on it and by mathematical constraints on the eļ¬€ects (and possibly cost) of those operations. Using Abstract Data Types 1 An abstract object may be operated upon by the operations which deļ¬ne its abstract type. 2 An abstract object may be passed as a parameter to a procedure. 3 An abstract object may be assigned to a variable. 9 / 30
  • 21. Images/cinvestav- Using Abstract Data Types Something Notable An abstract data type is deļ¬ned indirectly, only by the operations that may be performed on it and by mathematical constraints on the eļ¬€ects (and possibly cost) of those operations. Using Abstract Data Types 1 An abstract object may be operated upon by the operations which deļ¬ne its abstract type. 2 An abstract object may be passed as a parameter to a procedure. 3 An abstract object may be assigned to a variable. 9 / 30
  • 22. Images/cinvestav- For More We have the following ā€œPROGRAMMING WITH ABSTRACT DATA TYPESā€ by Barbara Liskov and Stephen Zilles 10 / 30
  • 23. Images/cinvestav- Abstract Data Types: An Example We will start with An example using Lists. Actually in Java An interface in the Java programming language is an abstract type that is used to specify an interface (in the generic sense of the term) that classes must implement. 11 / 30
  • 24. Images/cinvestav- Abstract Data Types: An Example We will start with An example using Lists. Actually in Java An interface in the Java programming language is an abstract type that is used to specify an interface (in the generic sense of the term) that classes must implement. 11 / 30
  • 25. Images/cinvestav- Outline 1 Introduction Basic Ideas Abstract Data Types 2 Linear List: An Example of ADT Basic Deļ¬nition Operations 3 Generic Java Interface Abstract Classes Vs Interfaces 12 / 30
  • 26. Images/cinvestav- Linear (or Ordered) Lists Deļ¬nition A linear list is a data structure that holds a sequential list of elements. Instances They have the following structure, (e0, e1, e1, ..., enāˆ’1) Properties Where ei denotes a list element n ā‰„ 0 is ļ¬nite List size is n 13 / 30
  • 27. Images/cinvestav- Linear (or Ordered) Lists Deļ¬nition A linear list is a data structure that holds a sequential list of elements. Instances They have the following structure, (e0, e1, e1, ..., enāˆ’1) Properties Where ei denotes a list element n ā‰„ 0 is ļ¬nite List size is n 13 / 30
  • 28. Images/cinvestav- Linear (or Ordered) Lists Deļ¬nition A linear list is a data structure that holds a sequential list of elements. Instances They have the following structure, (e0, e1, e1, ..., enāˆ’1) Properties Where ei denotes a list element n ā‰„ 0 is ļ¬nite List size is n 13 / 30
  • 29. Images/cinvestav- Linear (or Ordered) Lists Deļ¬nition A linear list is a data structure that holds a sequential list of elements. Instances They have the following structure, (e0, e1, e1, ..., enāˆ’1) Properties Where ei denotes a list element n ā‰„ 0 is ļ¬nite List size is n 13 / 30
  • 30. Images/cinvestav- What are the relations inside of a Liner List? Having this L = (e0, e1, e2, ..., enāˆ’1) Relationships e0 is the zeroā€™th (or front) element enāˆ’1 is the last element ei immediately precedes ei+1 14 / 30
  • 31. Images/cinvestav- What are the relations inside of a Liner List? Having this L = (e0, e1, e2, ..., enāˆ’1) Relationships e0 is the zeroā€™th (or front) element enāˆ’1 is the last element ei immediately precedes ei+1 14 / 30
  • 32. Images/cinvestav- What are the relations inside of a Liner List? Having this L = (e0, e1, e2, ..., enāˆ’1) Relationships e0 is the zeroā€™th (or front) element enāˆ’1 is the last element ei immediately precedes ei+1 14 / 30
  • 33. Images/cinvestav- What are the relations inside of a Liner List? Having this L = (e0, e1, e2, ..., enāˆ’1) Relationships e0 is the zeroā€™th (or front) element enāˆ’1 is the last element ei immediately precedes ei+1 14 / 30
  • 34. Images/cinvestav- Examples Simple ones Students in COP3530 = (Jack, Jill, Abe, Henry, Mary, ..., Judy) Exams in COP3530 = (exam1, exam2, exam3) Days of Week = (S, M, T, W, Th, F, Sa) Months = (Jan, Feb, Mar, Apr, ..., Nov, Dec) 15 / 30
  • 35. Images/cinvestav- Examples Simple ones Students in COP3530 = (Jack, Jill, Abe, Henry, Mary, ..., Judy) Exams in COP3530 = (exam1, exam2, exam3) Days of Week = (S, M, T, W, Th, F, Sa) Months = (Jan, Feb, Mar, Apr, ..., Nov, Dec) 15 / 30
  • 36. Images/cinvestav- Examples Simple ones Students in COP3530 = (Jack, Jill, Abe, Henry, Mary, ..., Judy) Exams in COP3530 = (exam1, exam2, exam3) Days of Week = (S, M, T, W, Th, F, Sa) Months = (Jan, Feb, Mar, Apr, ..., Nov, Dec) 15 / 30
  • 37. Images/cinvestav- Examples Simple ones Students in COP3530 = (Jack, Jill, Abe, Henry, Mary, ..., Judy) Exams in COP3530 = (exam1, exam2, exam3) Days of Week = (S, M, T, W, Th, F, Sa) Months = (Jan, Feb, Mar, Apr, ..., Nov, Dec) 15 / 30
  • 38. Images/cinvestav- Outline 1 Introduction Basic Ideas Abstract Data Types 2 Linear List: An Example of ADT Basic Deļ¬nition Operations 3 Generic Java Interface Abstract Classes Vs Interfaces 16 / 30
  • 39. Images/cinvestav- Which operations must be supported? We need the size of a linear list Hey, we need to know how many elements the linear list has. Determine list size for L = (a, b, c, d, e) So, we need to have a operation that returns the size size(L)=5 17 / 30
  • 40. Images/cinvestav- Which operations must be supported? We need the size of a linear list Hey, we need to know how many elements the linear list has. Determine list size for L = (a, b, c, d, e) So, we need to have a operation that returns the size size(L)=5 17 / 30
  • 41. Images/cinvestav- Which operations must be supported? We need the size of a linear list Hey, we need to know how many elements the linear list has. Determine list size for L = (a, b, c, d, e) So, we need to have a operation that returns the size size(L)=5 17 / 30
  • 42. Images/cinvestav- Linear List Operations: get(theIndex) Get operations Get element with given index. For example L = (a, b, c, d, e) Thus get(0) = a get(2) = c get(4) = e get(-1) = error get(9) = error 18 / 30
  • 43. Images/cinvestav- Linear List Operations: get(theIndex) Get operations Get element with given index. For example L = (a, b, c, d, e) Thus get(0) = a get(2) = c get(4) = e get(-1) = error get(9) = error 18 / 30
  • 44. Images/cinvestav- Linear List Operations: get(theIndex) Get operations Get element with given index. For example L = (a, b, c, d, e) Thus get(0) = a get(2) = c get(4) = e get(-1) = error get(9) = error 18 / 30
  • 45. Images/cinvestav- Linear List Operations: get(theIndex) Get operations Get element with given index. For example L = (a, b, c, d, e) Thus get(0) = a get(2) = c get(4) = e get(-1) = error get(9) = error 18 / 30
  • 46. Images/cinvestav- Linear List Operations: get(theIndex) Get operations Get element with given index. For example L = (a, b, c, d, e) Thus get(0) = a get(2) = c get(4) = e get(-1) = error get(9) = error 18 / 30
  • 47. Images/cinvestav- Linear List Operations: get(theIndex) Get operations Get element with given index. For example L = (a, b, c, d, e) Thus get(0) = a get(2) = c get(4) = e get(-1) = error get(9) = error 18 / 30
  • 48. Images/cinvestav- Linear List Operations: get(theIndex) Get operations Get element with given index. For example L = (a, b, c, d, e) Thus get(0) = a get(2) = c get(4) = e get(-1) = error get(9) = error 18 / 30
  • 49. Images/cinvestav- Linear List Operations: indexOf(theElement) IndexOf operations Determine the index of an element. Example L = (a, b, d, b, a) Thus indexOf(d) = 2 indexOf(a) = 0 indexOf(z) = -1 19 / 30
  • 50. Images/cinvestav- Linear List Operations: indexOf(theElement) IndexOf operations Determine the index of an element. Example L = (a, b, d, b, a) Thus indexOf(d) = 2 indexOf(a) = 0 indexOf(z) = -1 19 / 30
  • 51. Images/cinvestav- Linear List Operations: indexOf(theElement) IndexOf operations Determine the index of an element. Example L = (a, b, d, b, a) Thus indexOf(d) = 2 indexOf(a) = 0 indexOf(z) = -1 19 / 30
  • 52. Images/cinvestav- Linear List Operations: indexOf(theElement) IndexOf operations Determine the index of an element. Example L = (a, b, d, b, a) Thus indexOf(d) = 2 indexOf(a) = 0 indexOf(z) = -1 19 / 30
  • 53. Images/cinvestav- Linear List Operations: indexOf(theElement) IndexOf operations Determine the index of an element. Example L = (a, b, d, b, a) Thus indexOf(d) = 2 indexOf(a) = 0 indexOf(z) = -1 19 / 30
  • 54. Images/cinvestav- Linear List Operations: add(theIndex, theElement) Deļ¬nition Add an element so that the new element has a speciļ¬ed index. If we have L = (a, b, c, d, e, f , g) Thus add(0,h) =ā‡’ L = (h, a, b, c, d, e, f , g) Thus, index of a, b, c, d, e, f , g increases by 1. 20 / 30
  • 55. Images/cinvestav- Linear List Operations: add(theIndex, theElement) Deļ¬nition Add an element so that the new element has a speciļ¬ed index. If we have L = (a, b, c, d, e, f , g) Thus add(0,h) =ā‡’ L = (h, a, b, c, d, e, f , g) Thus, index of a, b, c, d, e, f , g increases by 1. 20 / 30
  • 56. Images/cinvestav- Linear List Operations: add(theIndex, theElement) Deļ¬nition Add an element so that the new element has a speciļ¬ed index. If we have L = (a, b, c, d, e, f , g) Thus add(0,h) =ā‡’ L = (h, a, b, c, d, e, f , g) Thus, index of a, b, c, d, e, f , g increases by 1. 20 / 30
  • 57. Images/cinvestav- Example add(2,h) using the original L =ā‡’ L = (a, b, h, c, d, e, f , g) index of c, d, e, f , g increases by 1 What about out of the bound add(10,h) =ā‡’ error add(-6,h) =ā‡’ error 21 / 30
  • 58. Images/cinvestav- Example add(2,h) using the original L =ā‡’ L = (a, b, h, c, d, e, f , g) index of c, d, e, f , g increases by 1 What about out of the bound add(10,h) =ā‡’ error add(-6,h) =ā‡’ error 21 / 30
  • 59. Images/cinvestav- Example add(2,h) using the original L =ā‡’ L = (a, b, h, c, d, e, f , g) index of c, d, e, f , g increases by 1 What about out of the bound add(10,h) =ā‡’ error add(-6,h) =ā‡’ error 21 / 30
  • 60. Images/cinvestav- Linear List Operations: remove(theIndex) Deļ¬nition Remove and return element with given index. For example L = (a, b, c, d, e, f , g) Example Remove(2) returns c and L becomes (a, b, d, e, f , g) Index of d, e, f , g decreases by 1 22 / 30
  • 61. Images/cinvestav- Linear List Operations: remove(theIndex) Deļ¬nition Remove and return element with given index. For example L = (a, b, c, d, e, f , g) Example Remove(2) returns c and L becomes (a, b, d, e, f , g) Index of d, e, f , g decreases by 1 22 / 30
  • 62. Images/cinvestav- Linear List Operations: remove(theIndex) Deļ¬nition Remove and return element with given index. For example L = (a, b, c, d, e, f , g) Example Remove(2) returns c and L becomes (a, b, d, e, f , g) Index of d, e, f , g decreases by 1 22 / 30
  • 63. Images/cinvestav- What about the Error For L = (a, b, c, d, e, f , g) Thus remove(-1) =ā‡’ error remove(20) =ā‡’ error 23 / 30
  • 64. Images/cinvestav- What about the Error For L = (a, b, c, d, e, f , g) Thus remove(-1) =ā‡’ error remove(20) =ā‡’ error 23 / 30
  • 65. Images/cinvestav- The Final Abstract Data Type for Linear List Linear List AbstractDataType LinearList { instances ordered ļ¬nite collections of zero or more elements operations isEmpty(): return true iļ¬€ the list is empty, false otherwise size(): return the list size (i.e., number of elements in the list) get(index): return the element with ā€œindexā€ index indexOf(x): return the index of the ļ¬rst occurrence of x in the list, return -1 if x is not in the list remove(index): remove and return the indexth element, elements with higher index have their index reduced by 1 add(theIndex, x): insert x as the index of th element, elements with theIndex ā‰„ index have their index increased by 1 output(): output the list elements from left to right } 24 / 30
  • 66. Images/cinvestav- Java Interface We can implement this idea of Abstract Data Types Using Java through the generic interface!!! An interface may include constants and abstract methods (i.e., methods for which no implementation is provided). Example for List 25 / 30
  • 67. Images/cinvestav- Java Interface We can implement this idea of Abstract Data Types Using Java through the generic interface!!! An interface may include constants and abstract methods (i.e., methods for which no implementation is provided). Example for List p u b l i c i n t e r f a c e L i n e a r L i s t <Item>{ p u b l i c boolean isEmpty ( ) ; p u b l i c i n t s i z e ( ) ; p u b l i c Item get ( i n t index ) ; p u b l i c i n t indexOf ( Item myobject ) ; p u b l i c void add ( i n t index , Item myobject ) ; p u b l i c Item remove ( i n t index ) ; p u b l i c S t r i n g t o S t r i n g ( ) ; } 25 / 30
  • 68. Images/cinvestav- Implementing the Java Interface Using a calss to implement the interface c l a s s SimpleArrayList <Item> implements L i n e a r L i s t <Item>{ // code f o r a l l methods must be provided } 26 / 30
  • 69. Images/cinvestav- Outline 1 Introduction Basic Ideas Abstract Data Types 2 Linear List: An Example of ADT Basic Deļ¬nition Operations 3 Generic Java Interface Abstract Classes Vs Interfaces 27 / 30
  • 70. Images/cinvestav- Abstract Classes Vs Interfaces However, we have another way to implement ADT Abstract Classes Abstract Classes An abstract class is a special kind of class that cannot be instantiated. It is a contract that is used to deļ¬ne hierarchies for all subclasses. Interface An interface is not a class. An interface has no implementation. It only has the deļ¬nition of the methods without the body. 28 / 30
  • 71. Images/cinvestav- Abstract Classes Vs Interfaces However, we have another way to implement ADT Abstract Classes Abstract Classes An abstract class is a special kind of class that cannot be instantiated. It is a contract that is used to deļ¬ne hierarchies for all subclasses. Interface An interface is not a class. An interface has no implementation. It only has the deļ¬nition of the methods without the body. 28 / 30
  • 72. Images/cinvestav- Abstract Classes Vs Interfaces However, we have another way to implement ADT Abstract Classes Abstract Classes An abstract class is a special kind of class that cannot be instantiated. It is a contract that is used to deļ¬ne hierarchies for all subclasses. Interface An interface is not a class. An interface has no implementation. It only has the deļ¬nition of the methods without the body. 28 / 30
  • 73. Images/cinvestav- Abstract Classes Vs Interfaces However, we have another way to implement ADT Abstract Classes Abstract Classes An abstract class is a special kind of class that cannot be instantiated. It is a contract that is used to deļ¬ne hierarchies for all subclasses. Interface An interface is not a class. An interface has no implementation. It only has the deļ¬nition of the methods without the body. 28 / 30
  • 74. Images/cinvestav- Abstract Classes Vs Interfaces However, we have another way to implement ADT Abstract Classes Abstract Classes An abstract class is a special kind of class that cannot be instantiated. It is a contract that is used to deļ¬ne hierarchies for all subclasses. Interface An interface is not a class. An interface has no implementation. It only has the deļ¬nition of the methods without the body. 28 / 30
  • 75. Images/cinvestav- Abstract Classes Vs Interfaces However, we have another way to implement ADT Abstract Classes Abstract Classes An abstract class is a special kind of class that cannot be instantiated. It is a contract that is used to deļ¬ne hierarchies for all subclasses. Interface An interface is not a class. An interface has no implementation. It only has the deļ¬nition of the methods without the body. 28 / 30
  • 76. Images/cinvestav- Important We have A Java class may implement as many interfaces as it wants but can extend at most one class. This is why Once you have chosen your design you can enforce the structure using Abstract Classes!!! 29 / 30
  • 77. Images/cinvestav- Important We have A Java class may implement as many interfaces as it wants but can extend at most one class. This is why Once you have chosen your design you can enforce the structure using Abstract Classes!!! 29 / 30
  • 78. Images/cinvestav- Example of Abstract Class Code p u b l i c a b s t r a c t c l a s s L i n e a r L i s t <Item>{ p u b l i c boolean isEmpty ( ) ; p u b l i c i n t s i z e ( ) ; p u b l i c Item get ( i n t index ) ; p u b l i c i n t indexOf ( Item myobject ) ; p u b l i c void add ( i n t index , Item myobject ) ; p u b l i c Item remove ( i n t index ) ; p u b l i c S t r i n g t o S t r i n g ( ) ; } 30 / 30