SUNY Geneseo Department of Computer Science
{Date}
CSci 141, Fall 2003
Prof. Doug Baldwin
Hand out Homework 2
Lab handout available in labs tomorrow
Messages
Searching a binary search tree
Mini-assignment: phrase search w/ tree messages
boolean search( x )
if this.isEmpty()
return false
else if x.compareTo( this.root() ) > 0
return this.right().search( x )
else if x.compareTo( this.root() ) < 0
return this.left().search( x )
else
// root = x
return true
x.compareTo(y)
Does this really work?