Instructor: Dr. Michael Geiger Spring 2019 Lecture 34: Exam 3 Preview

Slides:



Advertisements
Similar presentations
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.
Advertisements

Binary Heaps CSE 373 Data Structures Lecture 11. 2/5/03Binary Heaps - Lecture 112 Readings Reading ›Sections
CS 206 Introduction to Computer Science II 10 / 31 / 2008 Happy Halloween!!! Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 11 / 04 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 03 / 20 / 2009 Instructor: Michael Eckmann.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
Heaps & Priority Queues Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
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.
Compiled by: Dr. Mohammad Alhawarat BST, Priority Queue, Heaps - Heapsort CHAPTER 07.
1 Hash Tables  a hash table is an array of size Tsize  has index positions 0.. Tsize-1  two types of hash tables  open hash table  array element type.
PRIORITY QUEUES (HEAPS). Queues are a standard mechanism for ordering tasks on a first-come, first-served basis However, some tasks may be more important.
ADT Table and Heap Ellen Walker CPSC 201 Data Structures Hiram College.
Advanced Data Structure Hackson Leung
1 Heaps and Priority Queues Starring: Min Heap Co-Starring: Max Heap.
PRIORITY QUEUES AND HEAPS CS16: Introduction to Data Structures & Algorithms Tuesday, February 24,
Final Exam Review CS Total Points – 60 Points Writing Programs – 50 Points Tracing Algorithms, determining results, and drawing pictures – 50.
1 Heaps and Priority Queues v2 Starring: Min Heap Co-Starring: Max Heap.
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.
Programming Abstractions Cynthia Lee CS106X. Topics:  Priority Queue › Linked List implementation › Heap data structure implementation  TODAY’S TOPICS.
Heaps & Priority Queues
Give Eg:? Queues. Introduction DEFINITION: A Queue is an ordered collection of element in which insertions are made at one end and deletions are made.
Final Exam Review CS Total Points – 20 Points Writing Programs – 65 Points Tracing Algorithms, determining results, and drawing pictures – 50.
COMP 103 Course Review. 2 Menu  A final word on hash collisions in Open Addressing / Probing  Course Summary  What we have covered  What you should.
Final Exam Review CS 3358.
ECE Application Programming
CSE373: Data Structures & Algorithms
CS 315 Data Structures B. Ravikumar Office: 116 I Darwin Hall Phone:
Priority Queues and Heaps
Week 15 – Monday CS221.
October 30th – Priority QUeues
Programming Abstractions
Week 11 - Friday CS221.
Source: Muangsin / Weiss
March 31 – Priority Queues and the heap
Cse 373 April 26th – Exam Review.
November 1st – Exam Review
CMSC 341 Lecture 13 Leftist Heaps
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Function and class templates
7/23/2009 Many thanks to David Sun for some of the included slides!
original list {67, 33,49, 21, 25, 94} pass { } {67 94}
Instructor: Dr. Michael Geiger Spring 2017 Lecture 34: Inheritance
Priority Queue and Binary Heap Neil Tang 02/12/2008
Binary Tree Application Operations in Heaps
ITEC 2620M Introduction to Data Structures
Hash Tables Chapter 12.7 Wherein we throw all the data into random array slots and somehow obtain O(1) retrieval time Nyhoff, ADTs, Data Structures and.
Ch. 12 Tables and Priority Queues
Priority Queues & Heaps
EECE.2160 ECE Application Programming
Final Review Dr. Yingwu Zhu.
CSE 12 – Basic Data Structures
EE 312 Final Exam Review.
Instructor: Dr. Michael Geiger Spring 2019 Lecture 29: Linked queues
Dynamic allocation (continued)
Chapter 12 Heap ADT © 2011 Pearson Addison-Wesley. All rights reserved.
Data Structures and Algorithm Analysis Priority Queues (Heaps)
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Instructor: Dr. Michael Geiger Spring 2019 Lecture 23: Exam 2 Preview
Data Structures for Shaping and Scheduling
Heaps and priority queues
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Getting queues right … finally (?)
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
EECE.2160 ECE Application Programming
Instructor: Dr. Michael Geiger Spring 2017 Lecture 36: Exam 3 Preview
Instructor: Dr. Michael Geiger Spring 2017 Lecture 30: Sorting & heaps
Instructor: Dr. Michael Geiger Spring 2017 Lecture 33: Hash tables
Lecture 16: Midterm recap + Heaps ii
Presentation transcript:

Instructor: Dr. Michael Geiger Spring 2019 Lecture 34: Exam 3 Preview EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019 Lecture 34: Exam 3 Preview

Data Structures: Exam 3 Preview Lecture outline Announcements/reminders Program 5 (extra credit) posted; due 5/9 5/9 last day to submit all code (late, regrade, etc) Exam 3: Wednesday 5/8 3-6 PM, Ball 208 Course eval to be submitted at final exam Link to be posted on site; blank copies available outside office Today’s lecture: Exam 3 Preview 7/5/2019 Data Structures: Exam 3 Preview

Data Structures: Exam 3 Preview Exam 3 notes Allowed two 8.5” x 11” double-sided sheet of notes No other notes, electronic devices (calculator, phone) Exam will last three hours but will be roughly same length as Exams 1/2 Covers lectures 27-33 7/5/2019 Data Structures: Exam 3 Preview

Data Structures: Exam 3 Preview Exam sections (CR = code reading, CW = code writing, MC = multiple choice) Array-based queues (CR/CW) Linked queues (CR/CW) Linked lists (CR/CW/maybe MC) Survey of other data types (MC) Binary search trees Heaps Priority queues Hash tables Extra credit 7/5/2019 Data Structures: Exam 3 Preview

Data Structures: Lecture 27 Review: Queue ADT Queue is first-in, first-out (FIFO) data structure Definition Ordered collection of data items Items only removed (or read) from the front Items only added to the back Operations Construction (start with empty queue) Check if queue is empty Enqueue: add data to the back of the queue Dequeue: remove data from the front of the queue Read item at front of queue 7/5/2019 Data Structures: Lecture 27

Review: Array-based queues Treat array as circular Issue #1: What do front/back refer to? Position to read/write next (start both at 0; read/write then inc) Position most recently read/written (start at -1 or cap-1; inc then read/write) Issue #2: Tracking full/empty Only store front/back and leave 1 array slot empty Store front/back & extra “empty” variable (either Boolean or just count # full/empty slots) 7/5/2019 Data Structures: Exam 2 Preview

Review: Linked data structures Linked queues Front pointer points to first node in queue Back pointer points to last node in queue Last node: next pointer = NULL See example code for specific details Linked lists Single pointer to first node Insert data in order Traverse to appropriate spot; change pointers to add new Can delete anywhere Update pointers to ensure list unbroken 7/5/2019 Data Structures: Exam 3 Preview

Review: Binary search tree Binary search tree: binary tree in which each node follows property value in left child of node ≤ value in node ≤ value in right child of node Source: https://commons.wikimedia.org/w/index.php?curid=488330 7/5/2019 Data Structures: Exam 3 Preview

Data Structures: Exam 3 Preview Review: Heaps A heap is a binary tree with properties: It is complete Each level of tree completely filled (except possibly bottom) It satisfies heap-order property Data in each node >= data in children Also called a maxheap If data in node <= data in children, it’s a minheap Can be efficiently stored in array Store all nodes at given level from left to right in consecutive locations If first element @ index 1, then, given index n Children are at indexes 2*n and 2*n + 1 Parent is at index n/2 Heapsort: O(n log(n)) sort Make array/part of array into heap, then move highest val Operate on smaller & smaller subsets 7/5/2019 Data Structures: Exam 3 Preview

Review: Priority Queue A collection of data elements Items stored in order by priority Higher priority items removed ahead of lower Commonly implemented in heap Highest priority item  top of heap Write priority queue operations in terms of heap operations Example: remove highest priority = remove top of heap 7/5/2019 Data Structures: Exam 3 Preview

Data Structures: Exam 3 Preview Review: Hash Tables In some situations faster search is needed Solution is to use a hash function Value of key field given to hash function Location in a hash table is calculated 7/5/2019 Data Structures: Exam 3 Preview

Review: Linear probing Observe the problem with same value returned by h(i) for different values of i Called collisions A simple solution is linear probing Linear search begins at collision location Continues until empty slot found for insertion 7/5/2019 Data Structures: Exam 3 Preview

Review: collision strategies Linear probing: start at index & search in order Quadratic probing Probe sequence from location i is i + 1, i – 1, i + 4, i – 4, i + 9, i – 9, … Secondary clusters can still form Double hashing Use a second hash function to determine probe sequence Chaining: build linked list at each position 7/5/2019 Data Structures: Exam 3 Preview

Data Structures: Exam 3 Preview Final notes Next time Exam 3: 5/8, 3-6 PM, Ball 208 Reminders: Program 5 (extra credit) posted; due 5/9 5/9 last day to submit all code (late, regrade, etc) Course eval to be submitted at final exam Link to be posted on site; blank copies available outside office 7/5/2019 Data Structures: Exam 3 Preview