Algorithms and OOD (CSC 207 2014S) : EBoards

CSC 207 2014S: Extra Session, Week 2



Can I send in my extra credit summary a week late?

Maybe once or twice. Don't make it a habit.

Can my peers have extra credit for Chinese New Year celebration 6-8 p.m. on Friday in Harris Center?


What will we be doing with ArrayLists?

Nothing explicit. At times, you will want expandable arrays, and you have three choices: Implement the expandable arrays yourself (this maybe an assignment), use ArrayList, use Vector.

ArrayLists and Vectors are both expandable arrays. ArrayLists only seem to expand one element at a time. Vectors expand more easily. ArrayLists allow internal deletion.

See examples/arrays/

Sam's Question: Can we design a thing like lists/arrays that (1) give fast access to individual elements; (2) won't behave too slowly if we do deleteElementAt(2), insertElementAt(2), getElementAt(1000000)

_How do we tell Java that we want an ArrayList that contains only strings?

Use angle brackets. That should make Java happy. You need to use a class (so Integer rather than int).

ArrayList<String> strings = new ArrayList<String> ();

How would you write average?

We'll come back to this tomorrow, but:

a/2 + b/2 + (isOdd(a) && isOdd(b) : 1 ? 0);

Only works in the sitation that they are both non-negative

Copyright (c) 2013-14 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.