Download presentation
Presentation is loading. Please wait.
Published byDaniela Lawson Modified over 8 years ago
1
CS2852 Week 5, Class 2 Today Queue Applications Circular Queue Implementation Testing SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1
2
Printer queue Customer queue This week’s lab (resonance simulation) Parsing Matching parenthesis Compiling expressions Function call stack Queue Applications SE-2811 Dr.Yoder 2 Stack Applications
3
A queue interface (Review) public interface Queue { E poll(); void offer(E element); E peek(); boolean isEmpty(); } (Not in Java API – see code examples) SE-2811 Dr.Yoder 3
4
Implementing a Queue (Review) With Java’s ArrayList: push: add(0,E) – EXERCISE: What is the Big-O? pop: remove(n-1) – EXERCISE: Big-O? peek: [EXERCISE!] – EXERCISE: Big-O? isEmpty: isEmpty() With Java’s LinkedList: push: add(0,E) – EXERCISE: What is the Big-O? pop: remove(n-1) – EXERCISE: Big-O? peek: [EXERCISE!] – EXERCISE: Big-O? isEmpty: isEmpty() SE-2811 Dr.Yoder 4
5
Two methods for each operation: One throws exceptions if nothing there The other returns null Java’s Queue Interface (Review) SE-2811 Dr.Yoder 5 Throws exception Returns special value Insertadd(e)offer(e) Removeremove()poll() Examineelement()peek()
6
Implementing a Circular Queue [See code] SE-2811 Dr.Yoder 6
7
Levels of Testing Unit – e.g. Single method or class Integration – e.g. Multiple classes System – Whole program in context used Acceptance – Confirming requirements met SE-2811 Dr.Yoder 7
8
Types of Testing Black-box testing – What we have done so far White-box testing – Code coverage, etc. Broken-box testing SE-2811 Dr.Yoder 8
9
Muddiest Point Wait for the slides, or follow this link to answer both questions at once: http://bit.ly/1Mow5a3 SE-2811 Dr.Yoder 9
10
SE-2811 Dr. Josiah Yoder 10 http://bit.ly/1Mow5a3
11
SE-2811 Dr. Josiah Yoder 11 http://bit.ly/1Mow5a3
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.