COP 3530 Data Structures & Algorithms

Slides:



Advertisements
Similar presentations
Copyright © 2002 Pearson Education, Inc. Slide 1.
Advertisements

Chapter 19 Standard Template Library. Copyright © 2006 Pearson Addison-Wesley. All rights reserved Learning Objectives Iterators Constant and mutable.
Data Structures Using C++ 2E
. STL: C++ Standard Library (continued). STL Iterators u Iterators are allow to traverse sequences u Methods  operator*  operator->  operator++, and.
Order Analysis of Algorithms Debdeep Mukhopadhyay IIT Madras.
Selection and Insertion Sort Mrs. C. Furman October 1, 2008.
Data Structures & Algorithms
What is generic programming? The essence of the generic programming approach is concept development: systematic classification of computing components.
COMP 171 Data Structures and Algorithms Tutorial 1 Template and STL.
Concept= a set of abstractions (e.g., types) (Generic Programming) Programming with Concepts defined by a set of requirements {vector, deque, list, set,
C++ Programming: Program Design Including Data Structures, Second Edition Chapter 22: Standard Template Library (STL)
Sorting Algorithms: Implemented using ARM Assembly
CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++
Generic programming starts with algorithms. Lift Minimal requirements: works with maximal family of types Concrete algorithm: requires specific data type.
Lecture 23 Today Standard Template Library Programs in: programs/p19 Bibliography: Textbook p.252,
Comp 245 Data Structures Stacks. What is a Stack? A LIFO (last in, first out) structure Access (storage or retrieval) may only take place at the TOP NO.
Data Structures Using C++ 2E
C++ How to Program, 8/e © by Pearson Education, Inc. All Rights Reserved.
Generic Programming Using the C++ Standard Template Library.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Standard Template Library (STL)
COP 3530 Data Structures & Algorithms Discussion Session 3.
Data Structures Using C++1 Chapter 4 Standard Template Library (STL)
Standard Template Library The Standard Template Library was recently added to standard C++. –The STL contains generic template classes. –The STL permits.
1 Iterators Good reference site:
CS 403, Class 23Slide #1 CS Programming Languages Class 23 November 16, 2000.
Chapter 22 STL Containers §22.1 STL Basics §22.2 STL Iterators §22.3 Sequence Containers §22.4 Associative Containers §22.5 Container Adapters.
 2003 Prentice Hall, Inc. All rights reserved.m ECE 2552 Dr. Këpuska based on Dr. S. Kozaitis Summer Chapter 15 - Class string and String Stream.
1 BIM304: Algorithm Design Time: Friday 9-12am Location: B4 Instructor: Cuneyt Akinlar Grading –2 Midterms – 20% and 30% respectively –Final – 30% –Projects.
Intro to the C++ STL Timmie Smith September 6, 2001.
STL Containers Inside Peter Sikachev Institute of Computer Graphics and Algorithms Vienna University of Technology.
Introduction The STL is a complex piece of software engineering that uses some of C++'s most sophisticated features STL provides an incredible amount.
Programming in C++ Michal Brabec Petr Malý. Standard Template Library Containers - vector, map, set, deque, list Algorithms - copy, replace, sort, find.
CS212: Object Oriented Analysis and Design Lecture 26: STL Containers.
1 The Standard Template Library The STL is a collection of Container classes These are class templates for containers. A container is an object that stores.
Lists and the Collection Interface Chapter 4. Chapter 4: Lists and the Collection Interface2 Chapter Objectives To become familiar with the List interface.
Final Exam Review COP4530.
CSCE 210 Data Structures and Algorithms
CS212: Object Oriented Analysis and Design
Data Structures Using C++ 2E
Iterators and Sequences
Operation performed by Linear Structure
Standard Template Library (STL)
Iterators An iterator permits you to examine the elements of a data structure one at a time. C++ iterators Input iterator Output iterator Forward iterator.
Starting Out with C++ Early Objects Eighth Edition
Sorting Data are arranged according to their values.
Data Structures 2018 Quiz Answers
Programming with Concepts
abstracting away the data structure
Data Representation Methods
Iterators An iterator permits you to examine the elements of a data structure one at a time. C++ iterators Input iterator Output iterator Forward iterator.
CS212: Object Oriented Analysis and Design
Final Exam Review COP4530.
Sorting Data are arranged according to their values.
Containers, Iterators, Algorithms, Thrust
Iterators An iterator permits you to examine the elements of a data structure one at a time. C++ iterators Input iterator Output iterator Forward iterator.
Iterators An iterator permits you to examine the elements of a data structure one at a time. C++ iterators Input iterator Output iterator Forward iterator.
Standard Template Library
Copyright © – Curt Hill STL List Details Copyright © – Curt Hill.
C++ STL Stack, Queue, and Deque
Information.
Data Representation Methods
Data Representation Methods
An Introduction to STL.
Insertion Sort Array index Value Insertion sort.
Some Definitions vector, string, deque, and list are standard sequence containers. set, multiset, map, multimap, unordered_set, unordered_multiset, unordered_map.
RANDOM NUMBERS SET # 1:
Generic Set Algorithms
the fourth iteration of this loop is shown here
Standard Template Library
Presentation transcript:

COP 3530 Data Structures & Algorithms Discussion Session 6 by Eyup

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

The abstract class linearList

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

The class arrayList

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: +=, -=, +, -, <, >, <=, >=, []

A bidirectional iterator for arrayList

A bidirectional iterator for arrayList (cont.)

A bidirectional iterator for arrayList (cont.)

Using iterators To be added into arrayList Initialization STL algorithms

STL algorithms Reverse Sort

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

Example

References http://www.cplusplus.com/reference/std/iterator/ http://www.cplusplus.com/reference/algorithm/ http://www.cplusplus.com/reference/stl/ Data structures, algorithms, and applications in C++, Sartaj Sahni. 2nd ed. http://www.cs.duke.edu/csed/tapestry/howtoe.pdf http://www.cplusplus.com/doc/tutorial/classes2/

Questions