Computer Science 1
Top Lectures Assignments Noticeboard

Indexing and Searching

Indexing - Another Way To Access Objects in a Vector

     String tmp;
     int s = messages.size();
     int i = 1;
     while (i <= s) {
       tmp = (String) messages.elementAt (i);
       System.out.println (tmp);
     }

Why have enumerations and indexing?

Searching

Exercise:

Rewrite the search method so that it starts its search at the end of the Vector and searches backward toward position 0. When would this be useful?
Last modified: 4/5/99