Sean Reliford wrote:Can no one help me??? this is seriously frustrating.
Hi sean,
It is frustrating because you are not thinking about the problem with ease,i mean the way you deal it if it's really practical.let me exemplify this-
suppose i have 2 buckets each having 3 balls having a number marked on each ball.now i want to compare the balls at the respected positions and then removes the one having smaller number marked on it and in case if the number clash then i will throw the both ones.
now the steps involved are:
1) look in both the baskets.
2) get both the balls at the same position.
3) compare them.
4) throw the least one or both if equal.
5)repeat the procedure for 3 times.
now the
java analog for this procedure is
1)iteration
2)List get(int index) method or Iterator's next() method.
3)use >,<,==(or like for fractions use Double.compare(double,double) or whichever is applicable).
4)since you are removing the element from least,use Iterator's remove() method.
5)you can use Iterator's hasNext() for this part.
you can use list.iterator() for getting a Iterator over the list....now you got a big hint rest is your job.
for the next time i will advice you to think about the programming problems practically(that's for what it's discovered),if you didn't than probably it's not for you.
Kind Regards,
Praveen.