Lect02 120929183452-phpapp02
-
Upload
getachew-ganfur -
Category
Documents
-
view
75 -
download
0
Transcript of Lect02 120929183452-phpapp02
Collections and Generics
Dr.Haitham A. El-Ghareeb
Information Systems DepartmentFaculty of Computers and Information Sciences
Mansoura University
September 30, 2012
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 1 / 13
Good News
Received: 23 September 2012
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 2 / 13
Good News
http://www.helghareeb.me/courses/dsa-2012
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 3 / 13
Collections
A collection is a structured data type that stores data and providesoperations for adding data to the collection.
Operations include:I removing data from the collectionI updating data in the collectionI and operations for setting and returning the values of different
attributes of the collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 4 / 13
Collections
A collection is a structured data type that stores data and providesoperations for adding data to the collection.
Operations include:I removing data from the collectionI updating data in the collectionI and operations for setting and returning the values of different
attributes of the collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 4 / 13
Collections
A collection is a structured data type that stores data and providesoperations for adding data to the collection.
Operations include:
I removing data from the collectionI updating data in the collectionI and operations for setting and returning the values of different
attributes of the collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 4 / 13
Collections
A collection is a structured data type that stores data and providesoperations for adding data to the collection.
Operations include:I removing data from the collection
I updating data in the collectionI and operations for setting and returning the values of different
attributes of the collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 4 / 13
Collections
A collection is a structured data type that stores data and providesoperations for adding data to the collection.
Operations include:I removing data from the collectionI updating data in the collection
I and operations for setting and returning the values of differentattributes of the collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 4 / 13
Collections
A collection is a structured data type that stores data and providesoperations for adding data to the collection.
Operations include:I removing data from the collectionI updating data in the collectionI and operations for setting and returning the values of different
attributes of the collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 4 / 13
Collection Types
Collections can be broken down into two types: linear and nonlinear.
A linear collection is a list of elements where one element follows theprevious element.
Elements in a linear collection are normally ordered by position (first,second, third, etc.).
Nonlinear collections hold elements that do not have positional orderwithin the collection.
An organizational chart is an example of a non- linear collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 5 / 13
Collection Types
Collections can be broken down into two types: linear and nonlinear.
A linear collection is a list of elements where one element follows theprevious element.
Elements in a linear collection are normally ordered by position (first,second, third, etc.).
Nonlinear collections hold elements that do not have positional orderwithin the collection.
An organizational chart is an example of a non- linear collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 5 / 13
Collection Types
Collections can be broken down into two types: linear and nonlinear.
A linear collection is a list of elements where one element follows theprevious element.
Elements in a linear collection are normally ordered by position (first,second, third, etc.).
Nonlinear collections hold elements that do not have positional orderwithin the collection.
An organizational chart is an example of a non- linear collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 5 / 13
Collection Types
Collections can be broken down into two types: linear and nonlinear.
A linear collection is a list of elements where one element follows theprevious element.
Elements in a linear collection are normally ordered by position (first,second, third, etc.).
Nonlinear collections hold elements that do not have positional orderwithin the collection.
An organizational chart is an example of a non- linear collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 5 / 13
Collection Types
Collections can be broken down into two types: linear and nonlinear.
A linear collection is a list of elements where one element follows theprevious element.
Elements in a linear collection are normally ordered by position (first,second, third, etc.).
Nonlinear collections hold elements that do not have positional orderwithin the collection.
An organizational chart is an example of a non- linear collection.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 5 / 13
Collection Properties and Methods
Collection Property is the collections Count, which holds the numberof items in the collection.
Collection operations, called methods, include:I Add (for adding a new element to a collection)I Insert (for adding a new element to a collection at a specified index)I Remove (for removing a specified element from a collection)I Clear (for removing all the elements from a collection)I Contains (for determining if a specified element is a member of a
collection)
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 6 / 13
Collection Properties and Methods
Collection Property is the collections Count, which holds the numberof items in the collection.
Collection operations, called methods, include:I Add (for adding a new element to a collection)I Insert (for adding a new element to a collection at a specified index)I Remove (for removing a specified element from a collection)I Clear (for removing all the elements from a collection)I Contains (for determining if a specified element is a member of a
collection)
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 6 / 13
Collection Properties and Methods
Collection Property is the collections Count, which holds the numberof items in the collection.
Collection operations, called methods, include:I Add (for adding a new element to a collection)I Insert (for adding a new element to a collection at a specified index)I Remove (for removing a specified element from a collection)I Clear (for removing all the elements from a collection)I Contains (for determining if a specified element is a member of a
collection)
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 6 / 13
Linear Collections
Direct Access Collections
Sequential Access Collections
Generalized Indexed Collections
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 7 / 13
Linear Collections
Direct Access Collections
Sequential Access Collections
Generalized Indexed Collections
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 7 / 13
Linear Collections
Direct Access Collections
Sequential Access Collections
Generalized Indexed Collections
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 7 / 13
Linear Collections
Direct Access Collections
Sequential Access Collections
Generalized Indexed Collections
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 7 / 13
Struct
DEMO
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 8 / 13
Non Linear Collections
Hierarchical Collections
Group Collections
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 9 / 13
Non Linear Collections
Hierarchical Collections
Group Collections
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 9 / 13
Non Linear Collections
Hierarchical Collections
Group Collections
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 9 / 13
My Collection Class
DEMO
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 10 / 13
Generic Programming
DEMO
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 11 / 13
Oversimplified Timing Tests
DEMO
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 12 / 13
Charting in .Net
DEMO
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 September 30, 2012 13 / 13