Skip to main content

CSC 151.03, Class 27: Trees

Overview

  • Preliminaries
    • Notes and news
    • Upcoming work
    • Extra credit
    • Questions
  • Lab
  • Debrief

News / Etc.

  • Folks had enough difficulty on this assignment that I plan to discuss it next week, probably on Wednesday.
  • GOOD LUCK to Women’s Soccer

Upcoming Work

  • Writeup for class 26 due TONIGHT at 10:30 p.m.
  • No lab writeup for class 27.
  • Assignment 7 due next Tuesday.
    • Not quite in perfect shape.
    • Choose your own partner, IN THIS CLASS.
  • Read Higher-order procedures for Friday’s class.
    • Yes, it’s ready!
  • Big picture
    • HW 7 due next 7 Nov. (Tuesday)
    • Exam 3 due 14 Nov. (Tuesday)
    • Project proposal due 20 Nov. (Monday!)
    • Project due 28 Nov. (Tuesday)
    • Project presentations Dec. 4 and 6.
    • Exam 4 due 5 December.
    • Optional final during finals week (any of the three CSC 151 exam times will be fine)

Extra credit (Academic/Artistic)

  • Rebirth Brass Band, TONIGHT at 7:30 p.m. in Herrick.
  • Scholars Convocation TOMOORROW at 11:00 a.m. in JRC 101.
  • CS Extras, Thursday at 4:15 p.m.: “Building your own programming language and other reasons to go to graduate school”
  • Leyla McCalla Trio, Nov. 6, Herrick

Extra credit (Peer)

  • Art SEPC hosts a pop-up art show Friday 7-10:30 pm in Food House 1128 East St (across from Cincinatti)
  • Grinnell Review submissions until Friday.
  • Apply to work for the S&B.

Extra credit (Misc)

Other good things

  • Pub (?) quiz tonight at 9 in Bob’s.
    • Sam will pay your entry fee if you ask nicely.

Questions

Lab

Why does vector->tree seem to be biased toward the left (right)?
It tries to put the middle element at the root.
When there are two “middle elements” it picks the left one. Why? Tradition.
That means that more elements end up on the right.
Why do we like binary search trees?
Searching is much faster. At each step, we can eliminate about half of the remaining elements from contention.
What’s the problem on number 7?
Moral: Trees need to be in appropriate order for binary search to work. You need to be sure that everything in the left subtree alphabetically precedes the thing at the root and everything in the right subtree alphabetically follows the thing at the root.

Debrief