I didn't like this:
public boolean equals( Object o )
{
return compareTo( (Item)o ) == 0;
}
EIMACS:
- I don't like this because you would never, ever want to use the first implementation of equals. Even though they make a note of this, it shows that the philosophy for their curriculum is out of touch with reality.
- Since the AB exam is no longer a thing, eimacs really needs to update their curriculum to stop focusing on the Collegeboard's curriculum. Operators like instanceof are important in Java, and acting like they don't exist is just plain stupid. I wish they would just teach instanceof once so they don't have to make a special case every time instanceof is necessary for solving a problem.
- Learned more about binary search, and wrote my own, which was kind of tough because I knew roughly what it should look like but forgot what the midpoint should be set to on each iteration.
- I had mid = (high - low) / 2, when it should actually be low + (high - low) / 2, or (high + low) / 2
- Learned that a binary search runs in O( log2n )
{
return ( o instanceof Item ) &&
( compareTo( (Item)o ) == 0 );
}