aspose file tools*
The moose likes Java in General and the fly likes need help with java algorithm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "need help with java algorithm" Watch "need help with java algorithm" New topic
Author

need help with java algorithm

indi anj
Greenhorn

Joined: Sep 11, 2005
Posts: 5
hi, i was going through java exercise and i did not understand this exercise. if you know anything, please post your comment here.

Consider the usual algorithm for determining whether a sequence of parentheses is balanced. Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order). What is the maximum number of parentheses that will ever appear on the stack AT ONE TIME during the computation?
A. 1
B. 2
C. 3
D. 4
E. 5 or more
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
This doesn't even look like a Java exercise. Algorithms are typically described in a language independent way. So do you know what "the usual algorithm for determining whether a sequence of parentheses is balanced" means? Do you have a guess at what the answer is? Better yet, can you justify your guess?

You need to make an attempt then I will be glad to provide feedback on what you think the right answer is.

Layne


Java API Documentation
The Java Tutorial
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

First, you need to fix your display name, as you've been asked to do in the past. Real-sounding first and last name, here. Thanks. Otherwise, I'll have to close your account.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help with java algorithm
 
Similar Threads
problem in sortings
Gist/Notes on Operator Precedence and Order Evaluation
SCJP for Java 5 Exercises
Need some help!!
A Dan Mock Exam Question (Dec 4)