STL
|
|
- Conrad Woods
- 5 years ago
- Views:
Transcription
1
2
3 А Э STL 3
4 А 5 1 2К 7 STL
5 ВВ Э ё C++ - C++ (StaЧНarН TОЦpХatО LТbrarв (STL)) STL ё STL ё C++ ё 5
6 ё 6
7 1 1) ; 2) STL ; 3) ) ; ) ; ) 4) ; 5) C++ 7
8 2 STL К ё (Standard Template Library(STL)) C++ ё 1 К ; ; ; ; 5 К ё Э 8
9 1) ; 2) - ; 3) ; 4) ; - 5) ; 6) " - - "; 7) Э 9
10 3 (vector) ё ё vector (deque) 10
11 К (list) STL 11
12 4А (set) - " " - (multiset) Э (map) " first pair second T& operator[](const " - key_type& x) 12
13 (multimap) 13
14 5 ( ) - 1) К ; 2) ; 3) ; 4) К ё К 14
15 1) ; 2) К ; 3) ; 4) 3 3 ё
16 2- ё C++ (int float char ) ё ё К 16
17 17
18 6 ё К / ё STL Э 18
19 n К n - n Э Э 19
20 7 Extensible Markup Language (XML) К -2 ё - К К БML бцх К 20
21 STL ё C++ 21
22 8 C++ 1- Name vector STL Insert O(N) Find - O(N) Erase O(N) Element access O(1) O(1) O(1) deque O(N) O(N) - O(1) O(1) O(logN) O(logN) O(logN) O(logN) list set multiset map multimap O(N) O(N) O(N) O(N) O(N) O(N) - O(1) O(1) O(logN) O(logN + count(key)) O(logN) O(logN + count(key)) O(1) O(N) O(logN) O(logN) O(logN) O(logN) - ё ё ё iterator insert(const_iterator position const T& x); 22
23 ё void push_back(const T& x); Э push_back(x) 3- push_back(x) 23 insert(end x) insert(end x)
24 4- push_back(x) insert(end x) push_back(x) template<class InputIterator class T> InputIterator find(inputiterator first InputIterator last const T& value); iterator erase(const_iterator position); ё void pop_back(); 24
25 Э pop_back() 5-6- pop_back() pop_back() erase(end) erase(end) 25 erase(end)
26 pop_back() reference operator[](size_type n); Э reference front(); Э front() 7- front() operator[0] 26 operator[0]
27 8- front() operator[0] front() reference back(); Э back() 27 operator[size - 1]
28 back() back() operator[size - 1] operator[size - 1] back() ё 28
29 iterator insert(const_iterator position const T& x); ё void push_front(const T& x); Э push_front(x) 11 - push_front(x) 29 insert(begin x) insert(begin x)
30 12 - push_front(x) insert(begin x) push_front() void push_back(const T& x); Э push_back(x) 30 insert(end x)
31 push_back(x) push_back(x) insert(end x) insert(end x) push_back() template<class InputIterator class T> 31
32 InputIterator find(inputiterator first InputIterator last const T& value); iterator erase(const_iterator position); ё void pop_front(); Э pop_front() 15 - pop_front() 32 erase(begin) erase(begin)
33 16 - pop_front() erase(begin) pop_front() void pop_back(); Э pop_back() 33 erase(end)
34 17 - pop_back() 18 - pop_back() erase(end) erase(end) 34 pop_back()
35 reference operator[](size_type n); Э reference front(); Э front() 19 - front() operator[0] 35 operator[0]
36 20 - front() operator[0] front() reference back(); Э back() 36 operator[size - 1]
37 back() back() operator[size - 1] operator[size - 1] 37 back()
38 ё iterator insert(const_iterator position const T& x); void push_front(const T& x); Э push_front(x) 23 - push_front(x) 38 insert(begin x) insert(begin x)
39 24 - push_front(x) insert(begin x) push_front(x) void push_back(const T& x); Э push_back(x) 39 insert(end x)
40 push_back(x) push_back(x) insert(end x) insert(end x) push_back(x) template<class InputIterator class T> 40
41 InputIterator find(inputiterator first InputIterator last const T& value); iterator erase(const_iterator position); void pop_front(); Э pop_front() 27 - pop_front() 41 erase(begin) erase(begin)
42 28 - pop_front() erase(begin) pop_front(x) void pop_back(); Э pop_back() 42 erase(end)
43 pop_back() pop_back() erase(end) erase(end) pop_back(x) Ч ( 43 )
44 for (iterator it = listbegin(); it!= listend() && n > 0; ++it --n); reference front(); Э reference back(); Э ё pair<iterator bool> insert(const value_type& x); Э iterator insert(const_iterator position const value_type& x); 44
45 insert(x) insert(x) insert(iterator x) insert(iterator x) 45
46 33 - insert(x) 34 - insert(x) insert(iterator x) insert(iterator x) 46
47 insert(x) insert(x) insert(iterator x) insert(iterator x) 47
48 insert(x) insert(x) insert(iterator x) insert(iterator x) 48
49 Э insert(x) insert(x) insert(iterator x) insert(iterator x) 49
50 insert(x) insert(x) insert(iterator x) insert(iterator x) 50
51 insert(iterator x) template<class InputIterator class T> InputIterator find(inputiterator first InputIterator last const T& value); size_type erase(const key_type& x); Э iterator find(const key_type& x); Э ё T& operator[](const Key& x); 51
52 9 К - - operator[] front() - operator[end] back() insert(iterator x) push_back(x) push_front(x) erase(iterator) pop_front() pop_back() erase(end) shrink_to_fit() 52
53 1) insert(iterator x) Э ё ; 2) erase(x); 3) Tfind(x) stdfind(first last value) 53 T-
54 10 STL vector<map<int set<int>>> Test; void Insert(int int int) 43-54
55 44 - void Erase(int int int) 45-55
56 46 - bool Find(int) 47-56
57 48 - int operator()(int int int) 49-57
58 50 - STL 58
59 ComboBox TextBox ComboBox TextBox Node Node -node MyControl -link Line -next List<int> -prev int -level int +Node() +Node(newNode MyControl) +Next int {set} +NextSize int {get} +GetNext(index int) int +Prev int{get set} 59
60 +Level int {get set} +IsChild bool {get} +IsParent bool {get} +X double {get} +Y double {get} +Width double {get} +Height double {get} +CentreX double {get} +CentreY double {get} +isfreenode bool {get} +isingraph bool {get} +SetColor() void Next GetNext index Nodes CreateNode() AddNode 60
61 52 - AddLink CreateLink() isingraph isfreenode ё 61
62 53 - ё 54-62
63 Create library CheckInputData() ё void Visit(int index int maxlevel XmlNode branch XmlDocument xdoc List<String> typeonlevel) index - NШНОs maxlevel 63
64 бцх branch - xdoc - бцх typeonlevel - ё typeonlevel 56 - С Мpp 64
65 C++ CreateHeader() CreateCpp() CreateHeader() ё include using name h 57 - h 65
66 CreateCpp() branch n- n m init ё branch branch[i][j] К j init i- m
67 n operator () n k kё 59 - Ч Insert() 67
68 Erase() 68
69 62 - ё ё 69
70 А Ю Э STL C++ Э Э 70
71 А 1 - Ы / ++ / ДЭ 2 Сttps//ruаТФТpОНТaШrР/аТФТ/ И ] // URL И ( ) 3 XML ДЭ ] // URL Сttps//ruаТФТpОНТaШrР/аТФТ/БML ( ) 4 Extensible Markup Language (XML) ДЭ Сttps//аааа3ШrР/БML/ ( ] // URL ) 5 Standard Template Library Programmer`s Guide [Э ] // URL http//wwwsgicom/tech/stl/indexhtml ( ) WorkТЧР DraПt StaЧНarН ПШr PrШРraЦЦТЧР LaЧРuaРО C++ ДЭ ] // URLhttp//wwwopen-stdorg/ ( 7 Templates (C++) ДЭ ) ]//URL https//msdnmicrosoftcom/ en-us/library/y097fkabaspx ( ) 71
72
Programming with Haiku
Programming with Haiku Lesson 2 Written by DarkWyrm All material 2010 DarkWyrm In our first lesson, we learned about how to generalize type handling using templates and some of the incredibly flexible
More informationStandard Library Reference
Standard Library Reference This reference shows the most useful classes and functions in the standard library. Note that the syntax [start, end) refers to a half-open iterator range from start to end,
More informationLectures 11,12. Online documentation & links
Lectures 11,12 1. Quicksort algorithm 2. Mergesort algorithm 3. Big O notation 4. Estimating computational efficiency of binary search, quicksort and mergesort algorithms 5. Basic Data Structures: Arrays
More informationThe Standard Template Library Classes
The Standard Template Library Classes Lecture 33 Sections 9.7, 9.8 Robb T. Koether Hampden-Sydney College Wed, Apr 23, 2014 Robb T. Koether (Hampden-Sydney College) The Standard Template Library Classes
More informationSTL Exception Handling Contract
STL Exception Handling Contract Dave Abrahams Introduction This documents the exception-handling behavior of the Standard Template Library available at ,
More informationA Standard flat_map. 1 Revisions. 2 Introduction. 3 Motivation and Scope. 1.1 Changes from R Changes from R0
A Standard flat_map Document Number: P0429R2 Date: 2016-08-31 Reply to: Zach Laine whatwasthataddress@gmail.com Audience: LWG/LEWG 1 Revisions 1.1 Changes from R1 Add deduction guides. Change value_type
More informationDocument Number: P0429R4 Date: Reply to: 0.1 Revisions... 1
Document Number: P0429R4 Date: 2018-05-05 Reply to: Zach Laine whatwasthataddress@gmail.com Audience: LWG A Standard flat_map Contents Contents i 0.1 Revisions.............................................
More informationA Standard flat_map. Drop the requirement on container contiguity; sequence container will do.
A Standard flat_map Document umber: P9R Date: 6-8- Reply to: Zach Laine whatwasthataddress@gmail.com Audience: LWG/LEWG Revisions. Changes from R Drop the requirement on container contiguity; sequence
More informationA Standard flat_map. 1 Introduction. 2 Motivation and Scope
A Standard flat_map Document umber: P49R Date: 6-8-3 Reply to: Zach Laine whatwasthataddress@gmail.com Audience: LWG/LEWG Introduction This paper outlines what a (mostly) API-compatible, non-node-based
More informationConcepts for the C++0x Standard Library: Containers
Concepts for the C++0x Standard Library: Containers Douglas Gregor Open Systems Laboratory Indiana University Bloomington, IN 47405 dgregor@osl.iu.edu Document number: N2085=06-0155 Date: 2006-09-09 Project:
More informationPolymorphism. Programming in C++ A problem of reuse. Swapping arguments. Session 4 - Genericity, Containers. Code that works for many types.
Session 4 - Genericity, Containers Polymorphism Code that works for many types. Dr Christos Kloukinas City, UoL http://staff.city.ac.uk/c.kloukinas/cpp (slides originally produced by Dr Ross Paterson)
More informationMaking std::vector constexpr
Making std::vector constexpr Document #: P1004R0 Date: 2018-04-01 Project: Programming Language C++ Audience: LEWG Reply-to: Louis Dionne 1 Abstract std::vector is not currently constexpr
More informationA Standard flat_set. This paper outlines what a (mostly) API-compatible, non-node-based set might look like.
A Standard flat_set Document Number: P1222R0 Date: 2018-10-02 Reply to: Zach Laine whatwasthataddress@gmail.com Audience: LEWG 1 Introduction This paper outlines what a (mostly) API-compatible, non-node-based
More informationSummary. Design. Layout
Flat containers wording Document number: P0460R0 Date: 2016-10-15 Reply-to: Sean Middleditch sean@middleditch.us Project: ISO JTC1/SC22/WG21: Programming Language C++ Audience: Library Evolution Working
More informationCS197c: Programming in C++
CS197c: Programming in C++ Lecture 2 Marc Cartright http://ciir.cs.umass.edu/~irmarc/cs197c/index.html Administration HW1 will be up this afternoon Written assignment Due in class next week See website
More informationOutline. Variables Automatic type inference. Generic programming. Generic programming. Templates Template compilation
Outline EDAF30 Programming in C++ 4. The standard library. Algorithms and containers. Sven Gestegård Robertz Computer Science, LTH 2018 1 Type inference 2 3 The standard library Algorithms Containers Sequences
More informationLectures 19, 20, 21. two valid iterators in [first, last) such that i precedes j, then *j is not less than *i.
Lectures 19, 20, 21 1. STL library examples of applications Explanations: The member function pop_back removes the last element of the controlled sequence. The member function pop_front removes the first
More informationModern and Lucid C++ for Professional Programmers. Part 7 Standard Containers & Iterators. Department I - C Plus Plus
Department I - C Plus Plus Modern and Lucid C++ for Professional Programmers Part 7 Standard Containers & Iterators Prof. Peter Sommerlad / Thomas Corbat Rapperswil, 8.11.2017 HS2017 STL Containers: General
More informationSTL Containers, Part II
CS106L Handout #08 Fall 2007 October 17, 2007 STL Containers, Part II Introduction Last week we talked about vector and deque, the STL's two managed array classes. However, the STL offers many other containers,
More informationTemplate based set of collection classes STL collection types (container types)
STL Collection Types Template based set of collection classes STL collection types (container types) Sequences vector - collection of elements of type T list - doubly linked list, only sequential access
More informationPurpose of Review. Review some basic C++ Familiarize us with Weiss s style Introduce specific constructs useful for implementing data structures
C++ Review 1 Purpose of Review Review some basic C++ Familiarize us with Weiss s style Introduce specific constructs useful for implementing data structures 2 Class The Class defines the data structure
More informationStructuur van Computerprogramma s 2
Structuur van Computerprogramma s 2 dr. Dirk Deridder Dirk.Deridder@vub.ac.be http://soft.vub.ac.be/ Vrije Universiteit Brussel - Faculty of Science and Bio-Engineering Sciences - Computer Science Department
More informationChapter 17: Linked Lists
Chapter 17: Linked Lists 17.1 Introduction to the Linked List ADT Introduction to the Linked List ADT Linked list: set of data structures (nodes) that contain references to other data structures list head
More informationStandard Template Library. Outline
C++ Standard Template Library Spring 2015 Yanjun Li CS2200 1 Outline Standard Template Library Containers & Iterators STL vector STL list STL stack STL queue Fall 2008 Yanjun Li CS2200 2 Software Engineering
More informationObject-Oriented Programming for Scientific Computing
Object-Oriented Programming for Scientific Computing STL and Iterators Ole Klein Interdisciplinary Center for Scientific Computing Heidelberg University ole.klein@iwr.uni-heidelberg.de Summer Semester
More informationConcepts for the C++0x Standard Library: Containers (Revision 1)
Concepts for the C++0x Standard Library: Containers (Revision 1) Douglas Gregor, Indiana University dgregor@osl.iu.edu Pablo Halpern, Bloomberg, L.P. phalpern@halpernwightsoftware.com Document number:
More informationSSE2034: System Software Experiment 3
SSE2034: System Software Experiment 3 Spring 2016 Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu STL Collection Types Template based set of collection
More information4WCE * 5 * : GEO. Air Products and Chemicals, Inc., 2009
ХН Ч АН А 4WCE-600700* 5 9 2015. 1 93 : * : 600.700 600.730 1. 2 2. 2 3. 2 4. 3 5. 5 6. 7 7.,,, 8 8. 9 9., 10 10. 12 11., 13 12. 14 13. 16 14. 16 15. 17 16. 17 17., 18 18. 21 19., 24 20., 25 21., 26 22.
More informationDoubly-Linked Lists
Doubly-Linked Lists 4-02-2013 Doubly-linked list Implementation of List ListIterator Reading: Maciel, Chapter 13 HW#4 due: Wednesday, 4/03 (new due date) Quiz on Thursday, 4/04, on nodes & pointers Review
More informationChapter 11: <list> Background <list>
Chapter 11: Background list splice sort merge exception safety The header defines just the template class list, which is a container that stores its controlled sequence of length N
More informationChapter 18: Stacks And Queues
Chapter 18: Stacks And Queues 18.1 Introduction to the Stack ADT Introduction to the Stack ADT Stack a LIFO (last in, first out) data structure Examples plates in a cafeteria return addresses for function
More informationCSCI-1200 Data Structures Fall 2018 Lecture 21 Hash Tables, part 1
Review from Lecture 20 CSCI-1200 Data Structures Fall 2018 Lecture 21 Hash Tables, part 1 Finishing binary search trees & the ds set class Operators as non-member functions, as member functions, and as
More informationStandard Containers Library (1)
TDDD38 APiC++ Standard Library Containers 211 Standard Containers Library (1) C++ containers are objects that store other objects data structures. controls allocation and deallocation of the stored objects
More informationExperiences with the design and implementation of space-efficient deques
Experiences with the design and implementation of space-efficient deques Jyrki Katajainen Bjarke Buur Mortensen Department of Computing, University of Copenhagen Universitetsparken 1, DK-2100 Copenhagen
More informationSets and MultiSets. Contents. Steven J. Zeil. July 19, Overview of Sets and Maps 4
Steven J. Zeil July 19, 2013 Contents 1 Overview of Sets and Maps 4 1 2 The Set ADT 6 2.1 The template header................................. 14 2.2 Internal type names.................................
More informationUnit 1: Preliminaries Part 4: Introduction to the Standard Template Library
Unit 1: Preliminaries Part 4: Introduction to the Standard Template Library Engineering 4892: Data Structures Faculty of Engineering & Applied Science Memorial University of Newfoundland May 6, 2010 ENGI
More informationChapter 17: Linked Lists
Chapter 17: Linked Lists Copyright 2009 Pearson Education, Inc. Copyright Publishing as Pearson 2009 Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 17.1 Introduction to the
More informationCS 103 Unit 12 Slides
1 CS 103 Unit 12 Slides Standard Template Library Vectors & Deques Mark Redekopp 2 Templates We ve built a list to store integers But what if we want a list of double s or char s or other objects We would
More informationStandard Template Library. Outline
C++ Standard Template Library Fall 2013 Yanjun Li CS2200 1 Outline Standard Template Library Containers & Iterators STL vector STL list STL stack STL queue Fall 2013 Yanjun Li CS2200 2 Software Engineering
More informationC++ Standard Template Library. Contents. Pierre Fierz. 1 Introduction. 2 Organization of STL Header Files. Organization of STL Header Files
Contents Chapter 3 1 Lecture Advanced C++ 05.03.2012 2 3 4 Associative 5 Associative 6 Bernese University of Applied Sciences School of Engineering and Information Technology Division of Computer Science
More information2014 Spring CS140 Final Exam - James Plank
2014 Spring CS140 Final Exam - James Plank Question 1 - Big O Part A: Suppose my friend Fred wants to prove the following statement: 5n 3 + 500 log 2 (n) = O(n 3 ) To do that, Fred is going to have to
More informationSTL: C++ Standard Library
STL: C++ Standard Library Encapsulates complex data structures and algorithms CSC 330 OO Software Design 1 We ve emphasized the importance of software reuse. Recognizing that many data structures and algorithms
More informationCSCI-1200 Data Structures Fall 2009 Lecture 20 Hash Tables, Part II
Review from Lecture 19 CSCI-1200 Data Structures Fall 2009 Lecture 20 Hash Tables, Part II Operators as non-member functions, as member functions, and as friend functions. A hash table is a table implementation
More informationProgramming in C++ using STL. Rex Jaeschke
Programming in C++ using STL Rex Jaeschke Programming in C++ using STL 1997, 1999, 2002, 2007, 2009 Rex Jaeschke. All rights reserved. Edition: 2.0 All rights reserved. No part of this publication may
More informationInitializer Lists for Standard Containers
Doc no: N2220=07-0080 Date: 2007-03-11 Reply-To: Gabriel Dos Reis gdr@cs.tamu.edu Initializer Lists for Standard Containers Gabriel Dos Reis Bjarne Stroustrup Texas A&M University Abstract This is a companion
More informationSplicing Maps and Sets (Revision 1)
Document number: N3645 Date: 2013-05-04 Project: Programming Language C++ Reference: N3485 Reply to: Alan Talbot cpp@alantalbot.com Howard Hinnant howard.hinnant@gmail.com James Dennett jdennett@google.com
More informationCS11 Advanced C++ Fall Lecture 1
CS11 Advanced C++ Fall 2006-2007 Lecture 1 Welcome! ~8 lectures Slides are posted on CS11 website http://www.cs.caltech.edu/courses/cs11 ~6 lab assignments More involved labs 2-3 week project at end CS
More informationStandard Template Library
Standard Template Library Wednesday, October 10, 2007 10:09 AM 9.3 "Quick Peek" STL history 1990s Alex Stepanov & Meng Lee of HP Labs 1994 ANSI/IS0 standard Components Container class templates Iterators
More informationAdvanced C++ STL. Tony Wong
Tony Wong 2017-03-25 C++ Standard Template Library Algorithms Sorting Searching... Data structures Dynamically-sized array Queues... The implementation is abstracted away from the users The implementation
More informationTEMPLATES AND ITERATORS
TEMPLATES AND ITERATORS Problem Solving with Computers-I https://ucsb-cs24-sp17.github.io/ 2 Announcements Checkpoint deadline for pa04 (aka lab05) is due today at 11:59pm Be sure to push your code to
More informationQueue Implementations
Queue Implementations 1 Circular Queues buffer of fixed capacity improvements and cost estimates 2 Deques the double ended queue queue as double linked circular list MCS 360 Lecture 17 Introduction to
More informationList, Stack, and Queues
List, Stack, and Queues R. J. Renka Department of Computer Science & Engineering University of North Texas 02/24/2010 3.1 Abstract Data Type An Abstract Data Type (ADT) is a set of objects with a set of
More informationCSCI-1200 Data Structures Fall 2015 Lecture 24 Hash Tables
CSCI-1200 Data Structures Fall 2015 Lecture 24 Hash Tables Review from Lecture 22 & 23 STL Queues & Stacks Definition of a Prioriry Queue / Binary Heap percolate_up and percolate_down A Heap as a Vector,
More informationPractice question Answers
Practice question Answers COMP-322, Winter 2012, All Sections These questions are not necessarily the same as a final as they aren t necessarily exactly representative of the degree of difficulty, length,
More informationToday. andyoucanalsoconsultchapters6amd7inthetextbook. cis15-fall2007-parsons-lectvii.1 2
TEMPLATES Today This lecture looks at techniques for generic programming: Generic pointers Templates The standard template library Thebestreferenceis: http://www.cppreference.com/index.html andyoucanalsoconsultchapters6amd7inthetextbook.
More informationSTL. Zoltán Porkoláb: C++11/14 1
STL Generic programming An example inserters, iterator-adapters, functors Efficiency Memory consuption characteristics Std::array Forward_list Unordered containers in C++11 Zoltán Porkoláb: C++11/14 1
More informationEE 355 Unit 10. C++ STL - Vectors and Deques. Mark Redekopp
1 EE 355 Unit 10 C++ STL - Vectors and Deques Mark Redekopp 2 Templates We ve built a list to store integers But what if we want a list of double s or char s or other objects We would have to define the
More informationSETS AND MAPS. Chapter 9
SETS AND MAPS Chapter 9 The set Functions Required methods: testing set membership (find) testing for an empty set (empty) determining set size (size) creating an iterator over the set (begin, end) adding
More informationCSCI-1200 Data Structures Spring 2014 Lecture 19 Hash Tables
CSCI-1200 Data Structures Spring 2014 Lecture 19 Hash Tables Announcements: Test 3 Information Test 3 will be held Monday, April 14th from 6-7:50pm in DCC 308 (Sections 1-5 & 7-9) and DCC 337 (Sections
More informationCSCI-1200 Data Structures Fall 2017 Lecture 23 Functors & Hash Tables, part II
CSCI-1200 Data Structures Fall 2017 Lecture 23 Functors & Hash Tables, part II Review from Lecture 22 A Heap as a Vector Building a Heap Heap Sort the single most important data structure known to mankind
More informationThe Standard Template Library. An introduction
1 The Standard Template Library An introduction 2 Standard Template Library (STL) Objective: Reuse common code Common constructs: Generic containers and algorithms STL Part of the C++ Standard Library
More information1. The term STL stands for?
1. The term STL stands for? a) Simple Template Library b) Static Template Library c) Single Type Based Library d) Standard Template Library Answer : d 2. Which of the following statements regarding the
More informationData Structures and Programming 資料結構與程式設計. Topic 3 Linear Lists Array. AbstractDataType linearlist. Linear List - Array Representation
Data Structures and Programming 資料結構與程式設計 Topic 3 Linear Lists Array 課程編號 :901 31900 EE 3011 科目名稱 : 資料結構與程式設計授課教師 : 黃鼎偉時間地點 : 一 678 電機二館 229 Abstract Data Type linearlist Abstract Data Type (ADT) AbstractDataType
More informationStacks and their Applications
Stacks and their Applications Lecture 23 Sections 18.1-18.2 Robb T. Koether Hampden-Sydney College Fri, Mar 16, 2018 Robb T. Koether Hampden-Sydney College) Stacks and their Applications Fri, Mar 16, 2018
More informationCSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too)
CSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too) HW6 NOTE: Do not use the STL map or STL pair for HW6. (It s okay to use them for the contest.)
More informationC++ 프로그래밍실습. Visual Studio Smart Computing Laboratory
C++ 프로그래밍실습 Visual Studio 2015 Templates & STL Contents Exercise Practice1 Templates & STL Practice 1-1 Template Classes #include using namespace std; template class Point { private:
More informationThis chapter serves mainly to gather and organize information about iterators. Some new concepts are also introduced for completeness.
Iterators Overview We have introduced, used, built, and studied iterators in several contexts, including List, TDeque, and TVector. We have seen that ordinary pointers also can be thought of as iterators
More informationVector. Vector Class. class Vector { public: typedef unsigned int size_type;
Vector Arrays in C++ must be pre-allocated to accomodate the maximum number of elements. Should an application attempt to add more than this number, the program may abort, or alter storage of adjacent
More informationAbstract Data Types 1
Abstract Data Types 1 Purpose Abstract Data Types (ADTs) Lists Stacks Queues 2 Abstract Data Types (ADTs) ADT is a set of objects together with a set of operations. Abstract in that implementation of operations
More informationTeaching with the STL
Teaching with the STL Joseph Bergin Pace University Michael Berman Rowan College of New Jersey 1 Part 1 Introduction to STL Concepts 2 STL: What and Why Generic data structures (containers) and algorithms
More informationvector<int> second (4,100); // four ints with value 100 vector<int> third (second.begin(),second.end()); // iterating through second
C++ Vector Constructors explicit vector ( const Allocator& = Allocator() ); explicit vector ( size_type n, const T& value= T(), const Allocator& = Allocator() ); template vector (
More informationStandard-Library Exception Safety
Standard-Library Exception Safety Bjarne Stroustrup AT&T Labs Research http://www.research.att.com/~bs Abstract Designing containers and algorithms that are simultaneously efficient and exception safe
More informationAbstract Data Types. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University
Abstract Data Types CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Purpose Abstract Data Types (ADTs) Lists Stacks Queues
More informationCSC 427: Data Structures and Algorithm Analysis. Fall 2004
CSC 47: Data Structures and Algorithm Analysis Fall 4 Associative containers STL data structures and algorithms sets: insert, find, erase, empty, size, begin/end maps: operator[], find, erase, empty, size,
More informationcontiguous_container proposal
Document number: P0494R0 Date: 2016-11-05 Reply-to: Ildus Nezametdinov Audience: LEWG, SG14 contiguous_container proposal I Summary This proposal tries to solve some issues of
More informationCS183 Software Design. Textbooks. Grading Criteria. CS183-Su02-Lecture 1 20 May by Eric A. Durant, Ph.D. 1
CS183 Software Design Dr. Eric A. Durant Email: durant@msoe.edu Web: http://people.msoe.edu/~durant/ courses/cs183 (coming soon) Office: CC43 (enter through CC27) Phone: 277-7439 1 Textbooks Required (same
More informationTDDD38 - Advanced programming in C++
TDDD38 - Advanced programming in C++ STL II Christoffer Holm Department of Computer and information science 1 Iterators 2 Associative Containers 3 Container Adaptors 4 Lambda Functions 1 Iterators 2 Associative
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Data Structures and Algorithms. Final Examination
University of Waterloo Department of Electrical and Computer Engineering ECE 250 Data Structures and Algorithms Instructor: Douglas Wilhelm Harder Time: 2.5 hours Aides: none 14 pages Final Examination
More informationAbstract Data Types 1
Abstract Data Types 1 Purpose Abstract Data Types (ADTs) Lists Stacks Queues 2 Primitive vs. Abstract Data Types Primitive DT: programmer ADT: programmer Interface (API) data Implementation (methods) Data
More informationFunction Templates. Consider the following function:
Function Templates Consider the following function: void swap (int& a, int& b) { int tmp = a; a = b; b = tmp; Swapping integers. This function let's you swap the contents of two integer variables. But
More informationThe Standard C++ Library
The Standard C++ Library Main Ideas Purpose Flexibility Efficiency Simple & Uniform Interface Q: What types can we put in a template param? A: Type which models the requested concept. Concepts - Example
More informationCSCI-1200 Data Structures Fall 2018 Lecture 19 Trees, Part III
CSCI-1200 Data Structures Fall 2018 Lecture 19 Trees, Part III Review from Lecture 17 & 18 Overview of the ds set implementation begin, find, destroy_tree, insert In-order, pre-order, and post-order traversal;
More informationTo know the relationships among containers, iterators, and algorithms ( 22.2).
CHAPTER 22 STL Containers Objectives To know the relationships among containers, iterators, and algorithms ( 22.2). To distinguish sequence containers, associative containers, and container adapters (
More informationCSCI-1200 Data Structures Fall 2017 Lecture 18 Trees, Part II
CSCI-1200 Data Structures Fall 2017 Lecture 18 Trees, Part II Review from Lecture 17 and Lab 9 Binary Trees, Binary Search Trees, & Balanced Trees STL set container class (like STL map, but without the
More informationAdvanced Data Structures and Algorithms
Advanced Data Structures and Algorithms CS 361 - Fall 2013 Lec. #09: Sorting Tamer Nadeem Dept. of Computer Science Class Objective/Overview Understand Declaration of Associative Container Familiarize
More informationCS 103 Unit 15. Doubly-Linked Lists and Deques. Mark Redekopp
1 CS 103 Unit 15 Doubly-Linked Lists and Deques Mark Redekopp 2 Singly-Linked List Review Used structures/classes and pointers to make linked data structures Singly-Linked Lists dynamically allocates each
More informationChapter 18: Stacks And Queues
Chapter 18: Stacks And Queues 18.1 Introduction to the Stack ADT Introduction to the Stack ADT Stack: a LIFO (last in, first out) data structure Examples: plates in a cafeteria return addresses for function
More informationDocument No.: J16/ WG21/N1098 Date: 17 July Programming Language C++
Document No.: J16/97-0060 WG21/N1098 Date: 17 July 1997 Project: Reply-To: Library WP changes for London ============================= Programming Language C++ Steve Rumsby steve@maths.warwick.ac.uk diff
More informationTypes of Containers: Sequences
Types of Containers: Sequences Bag vs. Sequence Both contain items Sequence: items are arranged in sequence and order matters Bag: items are arranged in sequence but order does not matter See deletion
More informationEE 355 Unit 11b. Doubly-Linked Lists and Deques. Mark Redekopp
1 EE 355 Unit 11b Doubly-Linked Lists and Deques Mark Redekopp 2 Singly-Linked List Review Used structures/classes and pointers to make linked data structures Singly-Linked Lists dynamically allocates
More informationCSCI-1200 Data Structures Spring 2018 Lecture 18 Trees, Part III
CSCI-1200 Data Structures Spring 2018 Lecture 18 Trees, Part III Review from Lecture 16 & 17 Overview of the ds set implementation begin, find, destroy_tree, insert In-order, pre-order, and post-order
More informationThe Standard C++ Library
The Standard C++ Library Main Ideas Purpose Flexibility Efficiency Simple & Uniform Interface Q: What types can we put in a template param? A: Type which models the requested concept. Concepts - Example
More informationChapter 18: Stacks And Queues. Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Chapter 18: Stacks And Queues Copyright 2009 Pearson Education, Inc. Copyright Publishing as Pearson 2009 Addison-Wesley Pearson Education, Inc. Publishing as Pearson Addison-Wesley 18.1 Introduction to
More informationEcole Nationale d Ingénieurs de Brest. Table des matières. L approche STL... 3 Les itérateurs... 15
Notes de cours Standard Template Library Ecole Nationale d Ingénieurs de Brest Table des matières L approche STL................................... 3 Les itérateurs....................................
More informationAssociative Containers and Iterators. Ali Malik
Associative Containers and Iterators Ali Malik malikali@stanford.edu Game Plan Recap Associative Containers Iterators Map Iterators The auto keyword (maybe) Range-Based for Loops (maybe) Recap Structs
More informationPlacement Insert for Containers (Revision 2)
Placement Insert for Containers (Revision 2) Abstract Document number: N2345 = 07-0205 Date: 2007-07-18 Project: Programming Language C++ Reference: N2315 = 07-0175 Reply to: Alan Talbot alan.talbot@teleatlas.com
More informationPIC10B/1 Winter 2014 Final Exam Study Guide
PIC10B/1 Winter 2014 Final Exam Study Guide Suggested Study Order: 1. Lecture Notes (Lectures 1-24 inclusive) 2. Examples/Homework 3. Textbook The final exam will test 1. Your ability to read a program
More informationCSCI-1200 Data Structures Spring 2016 Lecture 25 Hash Tables
CSCI-1200 Data Structures Spring 2016 Lecture 25 Hash Tables Announcements: HW 3 Due Date Because of the ongoing iclicker problems, we will extend the due date for homework 10 to Friday April 29 at 11:59:59
More informationCOEN244: Class & function templates
COEN244: Class & function templates Aishy Amer Electrical & Computer Engineering Templates Function Templates Class Templates Outline Templates and inheritance Introduction to C++ Standard Template Library
More informationData Structure and Algorithm Homework #2
Data Structure and Algorithm Homework #2 === Homework Reference Solution === Problem 1. Transfer a letter We can use the following structure to represent our list. struct Node{ char word[50]; struct Node
More information