Standard Template Library Bryce Boe 2013/08/20 CS24, - - PowerPoint PPT Presentation

standard template library
SMART_READER_LITE
LIVE PREVIEW

Standard Template Library Bryce Boe 2013/08/20 CS24, - - PowerPoint PPT Presentation

Standard Template Library Bryce Boe 2013/08/20 CS24, Summer 2013 C Outline Lab 7 Solu@on Project 2 Solu@on Project 3 Overview Extra


slide-1
SLIDE 1

Standard ¡Template ¡Library ¡

Bryce ¡Boe ¡ 2013/08/20 ¡ CS24, ¡Summer ¡2013 ¡C ¡

slide-2
SLIDE 2

Outline ¡

  • Lab ¡7 ¡Solu@on ¡
  • Project ¡2 ¡Solu@on ¡
  • Project ¡3 ¡Overview ¡
  • Extra ¡Credit ¡Assignment ¡
  • C++ ¡Standard ¡Template ¡Library ¡(STL) ¡
slide-3
SLIDE 3

Lab ¡7 ¡

  • Verify ¡whether ¡or ¡not ¡an ¡array ¡is ¡in ¡heap-­‑
  • rder ¡
  • Idea ¡1: ¡For ¡each ¡node ¡verify ¡its ¡children ¡(if ¡

present) ¡are ¡not ¡larger ¡

  • Idea ¡2: ¡For ¡each ¡node ¡verify ¡its ¡parent ¡is ¡not ¡

smaller ¡

  • <In ¡class ¡look ¡at ¡my ¡solu@on> ¡
slide-4
SLIDE 4

Project ¡2 ¡Solu@on ¡

  • <In ¡class ¡look ¡at ¡my ¡solu@on> ¡
slide-5
SLIDE 5

Project ¡3 ¡Overview ¡

  • Concept: ¡Hospital ¡emergency ¡room ¡log ¡
  • Logs ¡when ¡(1) ¡pa@ents ¡arrive, ¡(2) ¡pa@ents ¡are ¡

visited ¡by ¡a ¡doctor, ¡and ¡(3) ¡when ¡pa@ents ¡ leave ¡

slide-6
SLIDE 6

Input ¡File ¡

# ¡Priori@es ¡ 01 ¡Cough ¡ 10 ¡Bleeding ¡ # ¡Doctors ¡

  • Dr. ¡Doctor ¡

# ¡Pa@ent ¡Arrivals ¡ 08:00 ¡“Pa@ent ¡A” ¡“Head ¡ache” ¡25 ¡ 08:00 ¡“Pa@ent ¡B” ¡“Bleeding” ¡60 ¡

slide-7
SLIDE 7

Output ¡File ¡

08:00 ¡Pa@ent ¡A ¡arrives ¡ 08:00 ¡Pa@ent ¡B ¡arrives ¡ 08:00 ¡Dr. ¡Doctor ¡visits ¡Pa@ent ¡B ¡about ¡Bleeding ¡ 09:00 ¡Pa@ent ¡B ¡departs ¡ 09:00 ¡Dr. ¡Doctor ¡visits ¡Pa@ent ¡A ¡about ¡Head ¡ ache ¡ 09:25 ¡Pa@ent ¡A ¡departs ¡

slide-8
SLIDE 8

Data ¡Structures ¡to ¡Use ¡

  • Queue ¡

– Pa@ent ¡arrivals ¡ – Available ¡doctors ¡

  • MaxHeap ¡

– Pa@ents ¡who ¡are ¡wai@ng ¡to ¡see ¡a ¡doctor ¡ – Pa@ents ¡who ¡are ¡currently ¡seeing ¡a ¡doctor ¡

  • Hash ¡Table ¡

– Mapping ¡of ¡symptom ¡to ¡priority ¡

slide-9
SLIDE 9

Extra ¡Credit ¡Assignment ¡

  • 1024+ ¡word ¡reflec@on ¡essay ¡
  • How ¡has ¡this ¡course ¡made ¡an ¡impact ¡(can ¡be ¡

both ¡posi@ve ¡and ¡nega@ve) ¡on ¡you? ¡

  • Wri@ng ¡about ¡what ¡you ¡directly ¡learned ¡will ¡

not ¡be ¡sufficient ¡

  • Due ¡by ¡class ¡next ¡Tuesday ¡
slide-10
SLIDE 10

C++ ¡Standard ¡Template ¡Library ¡

  • algorithm ¡
  • vector ¡
  • queue ¡
  • unordered_map ¡(tomorrow’s ¡lab) ¡