Java Collections Framework Intro to Trees Checkout Bina naryTree - - PowerPoint PPT Presentation

java collections framework intro to trees
SMART_READER_LITE
LIVE PREVIEW

Java Collections Framework Intro to Trees Checkout Bina naryTree - - PowerPoint PPT Presentation

Java Collections Framework Intro to Trees Checkout Bina naryTree ees from SVN Part of written assignment 3 Examine the Code of Ethics of the ACM Focus on property rights Write a short reaction (up to 1 page single-spaced)


slide-1
SLIDE 1

Checkout Bina naryTree ees from SVN

Java Collections Framework Intro to Trees

slide-2
SLIDE 2

 Part of written assignment 3

  • Examine the Code of Ethics of the ACM

 Focus on property rights

  • Write a short reaction (up to 1 page single-spaced)
  • Details are in the assignment
slide-3
SLIDE 3
slide-4
SLIDE 4

 No prima donnas

  • Working way ahead, finishing on your own, or

changing the team’s work without discussion:

 harms the education of your teammates

 No laggards

  • Coasting by on your team’s work:

 harms your education

 Both extremes

 are selfish  may result in a failing grade for you on the project

slide-5
SLIDE 5

 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 with evidence that backs up the rating

 Positives  Key negatives

slide-6
SLIDE 6

Exce celle llent—Consistently went above and beyond: tutored teammates, carried more than his/her fair share of the load Ver Very good good—Consistently did what he/she was supposed to do, very well prepared and cooperative Satisfac actory ry—Usually did what he/she was supposed to do, acceptably prepared and cooperative Ordin rdinary—Often did what he/she was supposed to do, minimally prepared and cooperative Marg rginal—Sometimes failed to show up or complete tasks, rarely prepared Deficie cient—Often failed to show up or complete tasks, rarely prepared Unsati tisfa facto tory—Consistently failed to show up or complete tasks, unprepared Superf rfici icial al—Practically no participation No s sho how—No participation at all

slide-7
SLIDE 7
slide-8
SLIDE 8

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

java.util. il.Colle llection

A “factory method”

Q2

slide-9
SLIDE 9

Introduction and terminology

slide-10
SLIDE 10

 Class hierarchy tree (single inheritance only)  Directory tree in a file system

slide-11
SLIDE 11

 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!

Q5-7

slide-12
SLIDE 12

 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

Q8

slide-13
SLIDE 13

Which is larger, the sum of the heights or the sum of the depths of all nodes in a tree? The height o

  • f

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

Q9-14 14

slide-14
SLIDE 14

 A Binary Tree is either

  • em

empty ty, or

  • con

consists sts of:

 a distinguished node called the root, which contains an element, and  A left subtree TL, which is a binary tree  A right subtree TR, which is a binary tree

root TL TR

slide-15
SLIDE 15

Let’s implement a BinaryT BinaryTree ee<T> class including methods size() size(), height( height(), duplica duplicate( e(), and contain contains(T (T).