Discussion Board
Go to the previous messageThere are no next messages
Current Forum: Homework 4 - Huffman Trees (Part 1)
Date: Mon Oct 8 2001 11:27 pm
Author: Cipriani, Jason A. <jac4@andrew.cmu.edu>
Subject: Re: Solution (sort've a bad one)

well... i dunno. the only thing i can think of is maybe with the vector you were carelessly throwing around add(), addElement(), iterators, get(), etc... that's all i can think of. i mean, the following code does the same thing (not the SAME, but you know what i mean):

////////////////////////////////

Vector v = new Vector(200);
v.setSize(200);

v.set(myIndex, myObject);
v.set(myIndex2, myObject2);

////////////////////////////////

Object [] a = new Object[200];

a[myIndex] = myObject;
a[myIndex2] = myObject2;

////////////////////////////////

maybe you were accidently doing something like v.add(myIndex, myObject). add() doesn't SET the object at myIndex to myObject, it simply inserts myObject before the current object at myIndex.

maybe this helps

jason
Post response

Go to the previous messageThere are no next messages
Current Thread Detail:
Inexplicable/Strange Vector Problem      Zelinski, Adam C.      Mon Oct 8 2001 10:03 pm       
Solution (sort've a bad one)      Zelinski, Adam C.      Mon Oct 8 2001 10:56 pm       
Re: Solution (sort've a bad one)      Cipriani, Jason A.      Mon Oct 8 2001 11:27 pm       

Back to previous screen