Standard Template Library Bryce Boe 2013/08/20 CS24, Summer 2013 C.

Slides:



Advertisements
Similar presentations
Lecture 22, Revision 1 Lecture notes Java code – CodeFromLectures folder* Example class sheets – 4 of these plus solutions Extra examples (quicksort) Lab.
Advertisements

Lab Module 9 User-defined Statistics
Vectors, lists and queues
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part R4. Disjoint Sets.
CS252: Systems Programming Ninghui Li Program Interview Questions.
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Project 3, Standard Template Library (STL) Bryce Boe 2013/11/25 CS24, Fall 2013.
Heaps CSE 331 Section 2 James Daly. Reminder Project 2 is out Covers tree sets Due Friday at midnight Exam 1 will be Thursday, February 26 Review next.
Lecture 8 CS203. Implementation of Data Structures 2 In the last couple of weeks, we have covered various data structures that are implemented in the.
Templates and the STL Bryce Boe 2012/09/10 CS32, Summer 2012 B.
Binary Heaps CSE 373 Data Structures Lecture 11. 2/5/03Binary Heaps - Lecture 112 Readings Reading ›Sections
Priority Queues. Container of elements where each element has an associated key A key is an attribute that can identify rank or weight of an element Examples.
CS 240: Data Structures Tuesday, August 7 th 2-3 Trees, Proving Algorithms.
Accelerated Cascading Advanced Algorithms & Data Structures Lecture Theme 16 Prof. Dr. Th. Ottmann Summer Semester 2006.
Nick Harvey & Kevin Zatloukal
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L12 (Chapter 20) Lists, Stacks,
CS 206 Introduction to Computer Science II 04 / 29 / 2009 Instructor: Michael Eckmann.
1 Priority Queues A priority queue is an ADT where: –Each element has an associated priority –Efficient extraction of the highest-priority element is supported.
Cpt S 223 – Advanced Data Structures Course Review Midterm Exam # 2
CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++
1 Priority Queues (Heaps)  Sections 6.1 to The Priority Queue ADT  DeleteMin –log N time  Insert –log N time  Other operations –FindMin  Constant.
METU Computer Engineering Department
Maps A map is an object that maps keys to values Each key can map to at most one value, and a map cannot contain duplicate keys KeyValue Map Examples Dictionaries:
Priority Queues and Heaps Bryce Boe 2013/11/20 CS24, Fall 2013.
Course Introduction Bryce Boe 2012/08/06 CS32, Summer 2012 B.
Recursion Bryce Boe 2013/11/18 CS24, Fall Outline Wednesday Recap Lab 7 Iterative Solution Recursion Binary Tree Traversals Lab 7 Recursive Solution.
CS 1150 – Lab #3 – Representing Numbers TA – Sanjaya Wijeratne – Web Page -
Java Collections An Introduction to Abstract Data Types, Data Structures, and Algorithms David A Watt and Deryck F Brown © 2001, D.A. Watt and D.F. Brown.
DATA STRUCTURES (CS212D) Week # 1: Overview & Review.
Heapsort By Pedro Oñate CS-146 Dr. Sin-Min Lee. Overview: Uses a heap as its data structure In-place sorting algorithm – memory efficient Time complexity.
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
COP 3530 Data Structures & Algorithms Discussion Session 3.
Priority Queue. Priority Queues Queue (FIFO). Priority queue. Deletion from a priority queue is determined by the element priority. Two kinds of priority.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
Sorting Dr. Yingwu Zhu. Heaps A heap is a binary tree with properties: 1. It is complete Each level of tree completely filled Except possibly bottom level.
Team Project 1 Dr. Sunny Jeong & M.H. Park. Priority Scheduling Define your own priority, at least two According to each priority, implements suitable.
Data Structures Using C++1 Chapter 4 Standard Template Library (STL)
PRIORITY QUEUES AND HEAPS CS16: Introduction to Data Structures & Algorithms Tuesday, February 24,
1 Heaps (Priority Queues) You are given a set of items A[1..N] We want to find only the smallest or largest (highest priority) item quickly. Examples:
Chapter 2: Basic Data Structures. Spring 2003CS 3152 Basic Data Structures Stacks Queues Vectors, Linked Lists Trees (Including Balanced Trees) Priority.
COSC2007 Data Structures II Chapter 12 Tables & Priority Queues III.
Assignment #8: Industrial Revolution Scramble The following will help you review larger concepts of the industrial revolution and help you connect smaller.
CSS446 Spring 2014 Nan Wang.  To understand the implementation of linked lists and array lists  To analyze the efficiency of fundamental operations.
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.
Intro to the C++ STL Timmie Smith September 6, 2001.
CS223 Advanced Data Structures and Algorithms 1 Priority Queue and Binary Heap Neil Tang 02/09/2010.
Lecture 15 Jianjun Hu Department of Computer Science and Engineering University of South Carolina CSCE350 Algorithms and Data Structure.
Heaps & Priority Queues
Standard Template Library (STL) - Use Vector and Deque
Sorting Dr. Yingwu Zhu. Heaps A heap is a binary tree with properties: 1. It is complete Each level of tree completely filled Except possibly bottom level.
Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin, and Skylight.
Priority Queues and Heaps Data Structures and Algorithms CS 244 Brent M. Dingle, Ph.D. Department of Mathematics, Statistics, and Computer Science University.
More Binary Search Trees, Project 2 Bryce Boe 2013/08/06 CS24, Summer 2013 C.
Team assignments in CS 322 “Data Structures & Algorithms II” Jey Veerasamy CIS Adjunct Faculty Baker College Online.
CS-321 Dr. Mark L. Hornick 1 CS-321 – Computer Graphics Dr. Mark L. Hornick web: webCT: webct.msoe.edu.
1 CS Review, iClicker -Questions Week 15. ANY QUESTIONS? 2.
TUESDAY 05/04/2016 Professional English in Use, Medicine Hospitals.
CSCE 210 Data Structures and Algorithms
Chapter 11 Heap.
Software Engineering Lecture #6.
Templates. Templates Example: Swap Template Mechanism.
Transp Course 2014 Overview.
Ideas to be Adopted from IUCEE Workshop on Teaching Algorithms
Sorting Dr. Yingwu Zhu.
STL and Example.
X Y Relation (a set of ordered pairs) x y x y ( , ) x y Mapping
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Instructor: Dr. Michael Geiger Spring 2019 Lecture 34: Exam 3 Preview
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Presentation transcript:

Standard Template Library Bryce Boe 2013/08/20 CS24, Summer 2013 C

Outline Lab 7 Solution Project 2 Solution Project 3 Overview Extra Credit Assignment C++ Standard Template Library (STL)

Lab 7 Verify whether or not an array is in heap-order Idea 1: For each node verify its children (if present) are not larger Idea 2: For each node verify its parent is not smaller

Project 2 Solution

Project 3 Overview Concept: Hospital emergency room log Logs when (1) patients arrive, (2) patients are visited by a doctor, and (3) when patients leave

Input File # Priorities 01 Cough 10 Bleeding # Doctors Dr. Doctor # Patient Arrivals 08:00 “Patient A” “Head ache” 25 08:00 “Patient B” “Bleeding” 60

Output File 08:00 Patient A arrives 08:00 Patient B arrives 08:00 Dr. Doctor visits Patient B about Bleeding 09:00 Patient B departs 09:00 Dr. Doctor visits Patient A about Head ache 09:25 Patient A departs

Data Structures to Use Queue – Patient arrivals – Available doctors MaxHeap – Patients who are waiting to see a doctor – Patients who are currently seeing a doctor Hash Table – Mapping of symptom to priority

Extra Credit Assignment word reflection essay How has this course made an impact (can be both positive and negative) on you? Writing about what you directly learned will not be sufficient Due by class next Tuesday

C++ Standard Template Library algorithm vector queue unordered_map (tomorrow’s lab)