Forum: Java Nov 22nd, 2008 |
| Replies: 5 Views: 1,383 If you choose to make the table size prime, you should treat that as an invariant and make it prime with each resize as well. I say "if you choose to make the table size prime" because there are... |
Forum: Java Nov 22nd, 2008 |
| Replies: 5 Views: 1,383 1) You know the size of the table and you can keep track of the load factor by modifying a counter when you add or remove a chain. This is pretty efficient.
2) Separate chaining is much more... |
Forum: Java Oct 13th, 2008 |
| Replies: 11 Views: 1,383 >Is there a better way?
Yes, design the class hierarchy such that you don't need to know the dynamic type of the object. Perhaps some form of strategy pattern would clean up that selection code. |
Forum: Java Jan 10th, 2008 |
| Replies: 15 Views: 1,357 >public static double max(double[]x)
This signature suggests that you're supposed to pass an array of doubles to the function and the function returns the largest of them. Your code doesn't do that... |
Forum: Java Oct 27th, 2004 |
| Replies: 4 Views: 4,942 >I'm trying to compare a string to an ArrayList Object.
This is your problem. Unless you can figure out a way to convert the ArrayList to a String so that they are comparable, you'll need to... |