Forum: Java Nov 22nd, 2008 |
| Replies: 5 Views: 1,283 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,283 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,341 >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: 14 Views: 1,025 >to be able to see the importance of "front"..
If enqueue places an item at the rear of the array, then front is only important in the inverse operation: dequeue. I fail to see how your teacher... |
Forum: Java Jan 10th, 2008 |
| Replies: 14 Views: 1,025 >why is it not needed? hehehe
You're just screwing with me, aren't you? |
Forum: Java Jan 10th, 2008 |
| Replies: 14 Views: 1,025 It's possible, but not needed. |
Forum: Java Jan 10th, 2008 |
| Replies: 14 Views: 1,025 >but its a requirement for me hehehe..
You're required to use front in the enqueue method? Maybe you should describe exactly what your assignment is so that I don't have to play 20 questions with... |
Forum: Java Jan 10th, 2008 |
| Replies: 15 Views: 1,347 >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 Jan 10th, 2008 |
| Replies: 14 Views: 1,025 >im not really good at programming thats why...
Then you're probably not quite ready for a circular queue implementation. In that case, enqueue doesn't need to use front at all. |
Forum: Java Jan 10th, 2008 |
| Replies: 14 Views: 1,025 >umm how do i implement the "front" to the public boolean enqueue (int x) ??
If I told you, that would defeat the purpose of my exercises, wouldn't it? |
Forum: Java Jan 10th, 2008 |
| Replies: 7 Views: 806 It's impossible to help you unless you post your code. |
Forum: Java Jan 10th, 2008 |
| Replies: 14 Views: 1,025 >what does the "front" do?
A queue allows you to work with both "ends" of the data structure. You enqueue (add items) onto the rear and dequeue (remove items) from the front. This gives you the... |
Forum: Java Jan 8th, 2008 |
| Replies: 2 Views: 4,806 >For starters, I'll state that I'm not exactly sure what the 'height' of a b-tree represents.
The height of a binary search tree is the number of nodes in the longest path to a leaf.
>Do you have... |
Forum: Java Jan 8th, 2008 |
| Replies: 7 Views: 806 >Does anybody know how to make a parser???
Yes. |
Forum: Java Dec 31st, 2007 |
| Replies: 12 Views: 2,852 The message is pretty clear about what's wrong. You say that insertNumber returns an integer value, but you fail to return a value with a return statement:
return 0; // Or some other number |
Forum: Java Dec 11th, 2007 |
| Replies: 9 Views: 980 "For Dummies" books are dumbed down so much that it's virtually impossible to properly learn a technical subject like programming from them. What's worse is that the authors themselves tend to need... |
Forum: Java Jun 1st, 2007 |
| Replies: 4 Views: 1,141 >public void itemStateChanged(ItemEvent ie)
Either that's a typo and ie should be e, or you need to change any use of e to ie. |
Forum: Java Mar 7th, 2006 |
| Replies: 11 Views: 4,538 Can you post the code as well? |
Forum: Java Nov 23rd, 2005 |
| Replies: 4 Views: 2,142 >can yo give me some example of virus because i like to learn more about.
1) This request has nothing to do with the topic of the thread.
2) The chances of someone giving you the code for a virus... |
Forum: Java Sep 26th, 2005 |
| Replies: 7 Views: 2,583 Vectors are evil, look up the ArrayList if you want an array that grows as needed. |
Forum: Java Jul 3rd, 2005 |
| Replies: 38 Views: 5,079 >Okay i really thought servercrash had written winxp in java
:rolleyes:
>I've even heard you can't do it in c/c++ either...But don't know if that's true or not.
It's true, some routines have to... |
Forum: Java May 2nd, 2005 |
| Replies: 2 Views: 7,869 >Is there a "neater" way to code the following?
System.out.println ( "All the values in the array are: " );
for ( T x: array1 )
System.out.println ( x );
Change T to whatever the type of... |
Forum: Java Apr 25th, 2005 |
| Replies: 8 Views: 3,203 >Well how come you couldn't consider that an answer?
Because your explanation was so convoluted I didn't understand it, but it didn't smell right. ;) |
Forum: Java Apr 25th, 2005 |
| Replies: 8 Views: 3,203 >In that case, you would be instantiating a class to get to the static
Huh? No, not at all. The following is legal:
class Outer {
static class Nested {}
}
class Test {
Outer.Nested obj... |
Forum: Java Apr 25th, 2005 |
| Replies: 8 Views: 3,203 >Would both abstract and static be correct answers?
No, abstract is the correct answer. static only means that a nested class doesn't designate an inner class. |
Forum: Java Apr 25th, 2005 |
| Replies: 14 Views: 2,028 >Everyone misunderstood his question.
No, apparently only paradox misunderstood. Everyone else seemed to get the joke. |
Forum: Java Apr 25th, 2005 |
| Replies: 14 Views: 2,028 Lazy people who want hand outs deserve what they get. |
Forum: Java Apr 25th, 2005 |
| Replies: 14 Views: 2,028 >actually I don't believe they are...
The mad literalists answered the only question that was posed:
Since it's clearly a homework assignment, nobody with half a brain would just give away the... |
Forum: Java Apr 24th, 2005 |
| Replies: 14 Views: 2,028 Recursion is recursive and loops just repeat. |
Forum: Java Apr 13th, 2005 |
| Replies: 2 Views: 1,220 (int)Math.pow ( 2, b ); // Cast the result of pow to int |
Forum: Java Apr 12th, 2005 |
| Replies: 2 Views: 1,112 Math.pow(2, b) (http://java.sun.com/j2se/1.5.0/docs/api/) |
Forum: Java Apr 11th, 2005 |
| Replies: 3 Views: 5,897 >is ArrayList better than Vec
It depends on your needs. If you need a synchronized list and it has to be compatible with Java 1.1 then Vector is an option. Otherwise, ArrayList should be preferred,... |
Forum: Java Mar 18th, 2005 |
| Replies: 7 Views: 9,949 >Can you be more spesific with the term "linking to text file"
<a href="source.txt">Click here for some Javascript source</a> |
Forum: Java Mar 18th, 2005 |
| Replies: 7 Views: 9,949 You realize that the only thing in common with Java and Javascript is the word Java, right? What's wrong with just linking to a text file? At least that way you can fit more programs on a single page... |
Forum: Java Mar 15th, 2005 |
| Replies: 9 Views: 8,093 >I'd have changed it to m except that might be seen as slightly pickish
x is the better choice anyway, or my personal favorite identifier for "a chunk of memory that holds something": shtoobie. My... |
Forum: Java Mar 15th, 2005 |
| Replies: 7 Views: 3,573 >The greatest arrogance is thinking your ideas are better than those of the majority
Yes, and I'm an arrogant, willful, stubborn person. However, this reeks of the idea that the majority is always... |
Forum: Java Mar 15th, 2005 |
| Replies: 1 Views: 5,064 It looks fine, though what happens if you have a one or two node tree here?
return isBST(r,r.left.key, r.right.key);
It would be better to come up with some sentinel min and max value to pass... |
Forum: Java Mar 15th, 2005 |
| Replies: 9 Views: 8,093 >couldn't help tinker and use some more features of the Tiger
I also notice you didn't like my intuitive and obvious name for the HashMap, h. :cheesy: |
Forum: Java Mar 15th, 2005 |
| Replies: 7 Views: 3,573 >learn proper OO techniques
That I can understand.
>proper Java class naming
Sun recommends a style for Java, but that doesn't mean it has to be used. I disagree with several of their... |
Forum: Java Mar 14th, 2005 |
| Replies: 9 Views: 8,093 >static int countChars( String str, char searchChar )
This only returns the count for a single character. So to find the most common character, not only would you be forced to call countChars for... |