0% found this document useful (0 votes)
3 views

Collections-Trees, java framework notes

The document discusses the Java Collections Framework, focusing on trees and binary tree implementation. It emphasizes teamwork and performance evaluations in group projects, outlining grading criteria and the importance of collaboration. Additionally, it introduces key concepts related to trees, including terminology and methods for implementing a BinaryTree class.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Collections-Trees, java framework notes

The document discusses the Java Collections Framework, focusing on trees and binary tree implementation. It emphasizes teamwork and performance evaluations in group projects, outlining grading criteria and the importance of collaboration. Additionally, it introduces key concepts related to trees, including terminology and methods for implementing a BinaryTree class.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Java Collections Framework

Intro to Trees

Checkout BinaryTrees from SVN


 Pascal partner evaluation in Moodle due Weds
night

 Hopefully you are close to finishing either


Hardy or Evaluator by now and gotten a start
on the other one.
◦ If not, it is time to get moving!
Rose is teeming with teams
 No prima donnas
◦ Work together or divide work equitably
◦ Working way ahead, finishing on your own, or
changing the team’s work without discussion:
 is selfish
 harms the education of your teammates
 may result in a failing grade for you on the project
 No laggards
◦ Coasting by on your team’s work:
 is selfish
 harms your education
 may result in a failing grade for you on the project
 I’ll assign an overall grade to the project
 Grades of individuals will be adjusted up or
down based on team members’ assessments

 At the end of the project each of you will:


◦ Rate each member of the team, including yourself
◦ Write a short Performance Evaluation of each team
member
Excellent—Consistently went above and beyond: tutored teammates,
carried more than his/her fair share of the load
Very good—Consistently did what he/she was supposed to do, very
well prepared and cooperative
Satisfactory—Usually did what he/she was supposed to do, acceptably
prepared and cooperative
Ordinary—Often did what he/she was supposed to do, minimally
prepared and cooperative
Marginal—Sometimes failed to show up or complete tasks, rarely
prepared
Deficient—Often failed to show up or complete tasks, rarely prepared
Unsatisfactory—Consistently failed to show up or complete tasks,
unprepared
Superficial—Practically no participation
No show—No participation at all
 Ratings must be supported with evidence

 Performance evaluations document:


◦ Positives
◦ Key negatives

 Performance evaluations are standard


procedure in industry
◦ Why might that be the case?
 Document dates and actions:
◦ Jan. 1, stayed after mtg. to help Bob with hashing
◦ Jan. 19, failed to complete UML diagram as agreed

 List positives:
◦ The only way to help people improve!

 List key negatives:


◦ Not all negatives
◦ Egos are too fragile for long lists, can’t fix
everything at once anyway
 Keep a journal about the project

 I’ll grade your evaluations

 Your evaluations may be shared with the team


member being evaluated.

 Don’t keep your feelings to yourself

 Get me involved if your team can’t work out an


issue!
 Review: Java Collections Framework and
Iterators

 Introduction to trees

 Begin binary tree implementation

 Today or tomorrow will include some work


time
Q1

Available, efficient, bug-free


implementations of many key data
structures

Most classes are in java.util

Weiss Chapter 6 has more


details about collections
Q2

 Done with an interface, e.g., java.util.Collection

A “factory
method”
Q3

 In Java, specified by java.util.Iterator<E>

 ListIterator<E> adds:
ag can be any Collection of Integers

The Java compiler translates the above into this:


 addAll(Collection other)

 containsAll(Collection other)

 removeAll(Collection other)

 retainAll(Collection other)

 toArray()
 Handy java.util.Arrays utility methods:

See
Collections
for similar
methods on
Lists
Q4

 weiss.util
◦ Shows "bare bones" possible implementations of
some of the classes in java.util
◦ Illustrates (just) the essence of what is involved in
implementation
 weiss.nonstandard
◦ Some other data structures, not found in
java.util
◦ Some alternate approaches to some classes that are
also in weiss.util

See links from day 8 and 9 of schedule


Introduction and terminology
 Class hierarchy tree (single inheritance only)
 Directory tree in a file system
Q5-7

 A collection of nodes
 Nodes are connected by directed edges.
◦ One special root node has no incoming edges
◦ All other nodes have exactly one incoming edge
 One way that Computer Scientists
are odd is that our trees
usually have their root at
the top!
Q8

 Parent
 Child
 Grandparent
 Sibling
 Ancestors and descendants
 Proper ancestors, proper descendants
 Subtree
 Leaf, interior node
 Depth and height of a node
 Height of a tree
Q9-14

The height of
a tree is the
height of its
root node.

Which is larger, the sum of


the heights or the sum of the
depths of all nodes in a tree?
 A Binary Tree is either
◦ empty, or
◦ consists of:
 a distinguished node called the root, which contains
an element, and
 A left subtree TL, which is a binary tree
root
 A right subtree TR, which is a binary tree

TL

TR
Let’s implement a
BinaryTree<T> class including
methods size(), height(),
duplicate(), and contains(T).

You might also like