View Single Post
  #4 (permalink)  
Old 07-24-2007, 01:07 AM
rpgfan3233 rpgfan3233 is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jul 2007
Posts: 118
iTrader: (0)
rpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura about
Instead of testing against the size of the stack, why not use a while loop and test whether it is empty. I personally think it would be much safer than the for loop, though I honestly still don't see the difference with that code:
PHP Code:
while (!s.empty()) {
    
Object o1 s.pop();
    
Object o2 q.dequeue();
    
String num1 = (String) o1;
    
String num2 = (String) o2;
    if (!
num1.equals(num2)) {
        
result "FALSE";
    } else {
        
result "TRUE";
    }

I honestly can't see any problem from the code you've presented.

__________________
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off."
-- Bjarne Stroustrup, creator of what is now known as C++
For more quotes by Bjarne Stroustrup, check out http://www.research.att.com/~bs/bs_faq.html#really-say-that.
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
The Following User Says Thank You to rpgfan3233 For This Useful Post:
HelloWorld (07-24-2007)