Presentation is loading. Please wait.

Presentation is loading. Please wait.

COP 3530 Data Structures & Algorithms

Similar presentations


Presentation on theme: "COP 3530 Data Structures & Algorithms"— Presentation transcript:

1 COP 3530 Data Structures & Algorithms
Discussion Session 6 by Eyup

2 Outline Linear lists - Array representation Operator overloading
arrayList iterator STL in C++ An example of bidirectional iterator Usage in STL algorithms Operator overloading

3 The abstract class linearList

4 Array representation List = {5, 2, 4, 8, 1} Insertion and removal

5 The class arrayList

6 Iterators in C++ Points to an element of an object Defined in STL
Five categories. All support ==, !=, *, ++ Input : Read access Output: Write access Forward: Read and write Bidirectional: -- Random access: +=, -=, +, -, <, >, <=, >=, []

7 A bidirectional iterator for arrayList

8 A bidirectional iterator for arrayList (cont.)

9 A bidirectional iterator for arrayList (cont.)

10 Using iterators To be added into arrayList Initialization
STL algorithms

11 STL algorithms Reverse Sort

12 Operator overloading Arithmetic operators Relational operators
I/O operators Constructors and conversions

13 Example

14 References http://www.cplusplus.com/reference/std/iterator/
Data structures, algorithms, and applications in C++, Sartaj Sahni. 2nd ed.

15 Questions


Download ppt "COP 3530 Data Structures & Algorithms"

Similar presentations


Ads by Google