Download presentation
Presentation is loading. Please wait.
Published byElinor Johnson Modified over 9 years ago
1
CS2852 Week 8, Class 2 Today Tree terminology Non-Binary and Non-Search Trees Tree Traversals (Remaining slides not yet shown) Tomorrow: Quiz Implementing contains (051) or add (021) Other tree questions Other Java Collections Framework questions SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1
2
Muddiest points on this lecture from 051 Complete and full definitions Exactly what is important about the Java Collection Framework. Aside from the general properties of frameworks What benefit does a pre-order traversal have? Complete vs Full vs that third type [perfect] of tree differences between full and complete When a tree is complete How to implement the different traversals how to do pre order traversal SE-2811 Dr.Yoder 2
3
Mudiest points on this lecture from 021 difference between complete and full The reason and need for the implementation of trees in adding/multiplying in a high level language SE-2811 Dr.Yoder 3
4
Outcomes for Today (051) Java Collection Framework Define the term adaptor class and be able to implement a simple adaptor class, e.g., stack, queue Describe the design flaw found in the Queue interface found in the Java Collection Framework SE-2811 Dr.Yoder 4
5
Outcomes for Today (both) Interpret and write Java code using the TreeMap and TreeSet classes Implement a recursive contains() method Describe how elements are removed from a binary search tree State and explain the asymptotic time complexity of the following methods from a TreeSet: add(E), clear(), contains(Object), isEmpty(), remove(Object), and size() SE-2811 Dr.Yoder 5
6
Pre-order traversal An Euler tour, Source: Wiki:Tree_traversal 6
7
In-order traversal An Euler tour, Source: Wiki:Tree_traversal 7
8
Post-order traversal An Euler tour, Source: Wiki:Tree_traversal SE-2811 Dr.Yoder 8
9
Level-order traversal An Euler tour, Source: Wiki:Tree_traversal SE-2811 Dr.Yoder 9
10
A tree where every non-leaf node has two children A tree with all levels completely filled Full tree SE-2811 Dr.Yoder 10 Perfect tree A tree with all but the lowest level completely filled. The lowest level must have all nodes on the left Complete tree
11
A compilation goal Compile expressions like x*y+5 Into code that only uses the low-level commands push(int) – push an integer value onto the stack mult() – pop the top two items, push their product add() – pop the top two items, pus their sum int pop() – pop the result, this is the value of the expression SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 11
12
Muddiest Point Wait for the slides, or follow this link to answer both questions at once: http://bit.ly/1Mow5a3 SE-2811 Dr.Yoder 12
13
SE-2811 Dr. Josiah Yoder 13 http://bit.ly/1Mow5a3
14
SE-2811 Dr. Josiah Yoder 14 http://bit.ly/1Mow5a3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.