intro to trees
play

Intro to Trees After today, you should be able to use tree - PowerPoint PPT Presentation

Intro to Trees After today, you should be able to use tree terminology write recursive tree functions Checkout Bina narySea ySearchT chTree ree from SVN Part of Homework 3 Examine the Code of Ethics of the ACM Focus on


  1. Intro to Trees After today, you should be able to… …use tree terminology …write recursive tree functions Checkout Bina narySea ySearchT chTree ree from SVN

  2.  Part of Homework 3 ◦ Examine the Code of Ethics of the ACM  Focus on property rights ◦ Write a reaction (1 page single-spaced) ◦ Details are in the assignment  This is part of the context of your work this term.

  3.  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

  4.  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

  5. Exce cellent lent — Consistently went above and beyond: tutored teammates, carried more than his/her fair share of the load Very y good — Consistently did what he/she was supposed to do, very well prepared and cooperative Satisfacto factory — Usually did what he/she was supposed to do, acceptably prepared and cooperative Ordina nary ry — Often did what he/she was supposed to do, minimally prepared and cooperative Margin inal al — Sometimes failed to show up or complete tasks, rarely prepared Deficient cient — Often failed to show up or complete tasks, rarely prepared Unsa satisf tisfacto ctory ry — Consistently failed to show up or complete tasks, unprepared Superfi ficia ial — Practically no participation No show — No participation at all

  6.  Now: an implementation that is more efficient and more complex to code than arrays…  … Trees!

  7. Introduction and terminology

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

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

  10.  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

  11. The height ht of a t 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?

  12.  A Binary Tree is either ◦ empty ty, or ◦ consi nsists sts of: a distinguished node called the root, which contains  an element, and  A left subtree T L , which is a binary tree root  A right subtree T R , which is a binary tree T L T R

  13.  What property enables us to search BSTs efficiently?

  14.  Let’s start the BinarySearchTrees assignment: implement a BinaryTree<T> class Test tree: 1 4 2 5 3 6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend