Exam Review 2 Chapter 5 – 9 CSC212 RS March 31, 2011, CS Dept, CCNY.

Slides:



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

1 Linked lists Sections 3.2, 3.3, 3.5 Chapter 3 Lists, Stacks, and Queues Abstract Data Types, Vectors.
Hold data and provide access to it. Random-access containers: -Allow accessing any element by index -arrays, vectors Sequential containers: -Allow accessing.
Exam Review 3 Chapters 10 – 13, 15 CSC212 Section FG CS Dept, CCNY.
C++ Templates. What is a template? Templates are type-generic versions of functions and/or classes Template functions and template classes can be used.
Project 3, Standard Template Library (STL) Bryce Boe 2013/11/25 CS24, Fall 2013.
Exceptions, Templates, And The Standard Template Library (STL) Chapter 16.
Copyright © 2012 Pearson Education, Inc. Chapter 16: Exceptions, Templates, and the Standard Template Library (STL)
Reviews for Exam 1 Chapter 1-4 CSc 212 Data Structures, Sec FG CCNY, Fall 2010.
Exam Review 3 Chapters 10 – 13, 15 CSC212 Section FG CS Dept, CCNY.
Final Exam Preview Chapter 4,5,6,7,8,9. Remember to evaluate CS221  Go to  Ends tonight.
@ Zhigang Zhu, CSC212 Data Structure - Section FG Lecture 10 The Bag and Sequence Classes with Linked Lists Instructor: Zhigang Zhu Department.
Exam Review 2 Chapter 5 – 9 CS211 November 05,2007, CS Dept, MHC.
CSC212 Data Structure - Section FG Lecture 12 Stacks and Queues Instructor: Zhigang Zhu Department of Computer Science City College of New York.
C++ Programming: Program Design Including Data Structures, Second Edition Chapter 22: Standard Template Library (STL)
CMSC 202 Lesson 24 Iterators and STL Containers. Warmup Write the class definition for the templated Bag class – A bag has: Random insertion Random removal.
1 Stack Data : a collection of homogeneous elements arranged in a sequence. Only the first element may be accessed Main Operations: Push : insert an element.
Review for Midterm Chapter 1-9 CSc 212 Data Structures.
Dr. Yingwu Zhu STL Vector and Iterators. STL (Standard Template Library) 6:14:43 AM 2 A library of class and function templates Components: 1. Containers:
Data Structures Using C++ 2E
C++ How to Program, 8/e © by Pearson Education, Inc. All Rights Reserved.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Midterm.
Recursion Textbook chapter Recursive Function Call a recursive call is a function call in which the called function is the same as the one making.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Standard Template Library (STL)
Data Structures Using C++ 2E Chapter 8 Queues. Data Structures Using C++ 2E2 Objectives Learn about queues Examine various queue operations Learn how.
C++ STL CSCI 3110.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
Friends & Standard Template Library CSCI3110 Advanced Data Structures Lecturer: Dr. Carroll and Nan Chen.
Data Structures: Advanced Damian Gordon. Advanced Data Structure We’ll look at: – Linked Lists – Trees – Stacks – Queues.
Foundation of Computing Systems Lecture 3 Stacks and Queues.
Slide 1 Linked Data Structures. Slide 2 Learning Objectives  Nodes and Linked Lists  Creating, searching  Linked List Applications  Stacks, queues.
CS342 Data Structures End-of-semester Review S2002.
Standard Template Library The Standard Template Library was recently added to standard C++. –The STL contains generic template classes. –The STL permits.
Introduction to the Standard Template Library (STL) A container class holds a number of similar objects. Examples: –Vector –List –Stack –Queue –Set –Map.
Copyright © 2002 Pearson Education, Inc. Slide 1.
CSC212 Data Structure - Section FG Lecture 11 Templates, Iterators and STL Instructor: Professor Zhigang Zhu Department of Computer Science City College.
Review for Exam 1 Topics covered: –Asymptotic analysis –Lists and list implementations Stacks and queues –General trees, binary trees –BST For each of.
Computer Science and Software Engineering University of Wisconsin - Platteville 11.Standard Template Library Yan Shi CS/SE 2630 Lecture Notes.
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
CSC 212 Sequences & Iterators. Announcements Midterm in one week  Will cover through chapter 5 of book  Midterm will be open book, open note (but, closed.
Queues Chapter 5 Queue Definition A queue is an ordered collection of data items such that: –Items can be removed only at one end (the front of the queue)
Copyright © 2009 – Curt Hill Standard Template Library An Introduction.
Introduction The STL is a complex piece of software engineering that uses some of C++'s most sophisticated features STL provides an incredible amount.
C++ Review STL CONTAINERS.
Exam Review 2 Chapter 5 – 9 CSC212 FG CS Dept, CCNY.
CSCI-383 Object-Oriented Programming & Design Lecture 25.
Lecture 7.  There are 2 types of libraries used by standard C++ The C standard library (math.h) and C++ The C++ standard template library  Allows us.
Chapter 17 – Templates. Function Templates u Express general form for a function u Example: template for adding two numbers Lesson 17.1 template Type.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Function Templates 16.2.
Unit VI.  C++ templates are a powerful mechanism for code reuse, as they enable the programmer to write code (classes as well as functions) that behaves.
Object-Oriented Programming (OOP) Lecture No. 41
Regarding homework 9 Many low grades
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Midterm Review.
Templates, Iterators and STL
ENERGY 211 / CME 211 Lecture 12 October 17, 2008.
Template Functions Chapter 6 introduces templates, which are a C++ feature that easily permits the reuse of existing code for new purposes. This presentation.
Prof. Michael Neary Lecture 7: The STL Prof. Michael Neary
Chapter 5 – 9 CSC212 AB April 03, CS Dept, CCNY
Chapter 5 – 9 CSC212 KL Nov 8, CS Dept, CCNY
Stacks, Queues, and Deques
Template Functions Chapter 6 introduces templates, which are a C++ feature that easily permits the reuse of existing code for new purposes. This presentation.
Multiset Class and its Iterator
Chapter 5 – 9 CSC212 RS April 08, CS Dept, CCNY
Templates. Templates Example: Swap Template Mechanism.
Containers and the Standard Template Library (STL)
Template Functions Chapter 6 introduces templates, which are a C++ feature that easily permits the reuse of existing code for new purposes. This presentation.
Container classes, ADTs
Tenth step for Learning C++ Programming
For each of these data structures
Presentation transcript:

Exam Review 2 Chapter 5 – 9 CSC212 RS March 31, 2011, CS Dept, CCNY

Chapter 5: Linked Lists Node Class (Ex 1-4, 6-9) Linked List Toolkit (Ex ) The bag Class with a Linked List (Ex 19-21, 23,24,26) The sequence class with a Linked List (Ex 27-30: please refer to assignment 4) Comparison of dynamic arrays, linked lists and doubly linked lists (Ex 31-36)

Chapter 6: Templates, Iterators and STL Template Functions and Template Classes –for code that is meant be reused in a variety of settings in a single program –Sections , Ex 1-3, 6-11 Iterators (Sec , Ex 17-28) –step through all items of a container in a standard manner Standard Template Library (Section 6.3, Ex ) –the ANSI/ISO C++ Standard provides a variety of container classes in the STL

All you need to know about Templates Template Function (Ex. 1-3) –a template prefix before the function implementation –template Function Prototype –a template prefix before the function prototypes Template Class (Ex. 6-10) –a template prefix right before the class definition Instantiation (Ex 11) –template functions/classes are instantiated when used Better Understanding of classes and functions

Iterators (Sec , Ex 17-28) We discussed how to build an iterator for the linked list so that each of the containers can build its own iterator(s) easily A node iterator is an object of the node_iterator class, and can step through the nodes of the linked list

Linked List Version the bag Template Class with an Iterator Most of the implementation of this new bag is a straightforward translation of the bag in Chapter 5 that used an ordinary linked list Two new features –Template class with a underlying type Item –iterator and const_iterator – defined from node_iterator and const_node_iterator, but use the C++ standard [...) left inclusive pattern

Standard Template Library (STL) The ANSI/ISO C++ Standard provides a variety of container classes in the STL –set, multiset, stack, queue, string, vector Featured templates and iterators For example, the multiset template class is similar to our bag template class More classes summarized in Appendix H

Chapters 7/8 Stacks and Queues Stacks and LIFO( Read Chapter 7, esp. 7.1 and 7.3 ) –Self-Test: 1, 2, 7, 8, 9, 10, Queues and FIFO ( Read Chapter 8, esp. 8.1 and 8.3 ) –Self-Test: 1, 2, 6,10, 11,12 Priority Queues ( Read Section 8.4 ) –Self-Test: 16, 17 References Return Values ( Read Section 8.5 and p. 302 in Chapter 6 ) –Self-Test: class note of Lecture 12

Chapter 9 Recursive Thinking Recursive Functions (Section 9.1) –Recursive Calls and Stopping Cases –Activation Record and Run-Time Stack –Self-Test: Exercises 1-4 Reasoning about Recursion (Section 9.3) –Infinite Recursion and One Level Recursion –Ensure no Infinite and Correctness –Ex. 9, 10 on page 448 Applications of Recursion (Optional :Section 9.2)