ART MOMENT:
.
![]() |
The Port of Venice Artist: Jan Brueghel the Elder (1568-1625) Worcester Art
Museum. Find samples of the artwork in the worcester art museum by searching here. Click on "Museum" and select WAM. |
At the end of today's class you should
HAVE READ:
KNOW:
BE ABLE TO:
DAILY QUESTION:
To continue our linked list examples, imagine that you
have a linked list of NumberNode objects in ascending sorted order.
Write the following contains method.
/**
* Determines if the sorted linked list contains a NumberNode representing
the given integer.
*
* @param i the target integer to search for.
* @return true if some NumberNode
object exists in the list representing i; false otherwise
*/
public boolean contains (int i) {
// FILL IN and be as efficient as you can.
}
Be sure that your method implementation completes as soon as possible. For
example, you might have a linked list containing several thousand numbers
(in sorted ascending order) but if you are looking for a "small" number, you
don't have to look through the whole list, right? Think about the case when
you can return false without having to look through any more numbers.
Sample Exam question(s)
TBA