|
-
April 6th, 2009, 09:40 AM
#1
search algorithm for formatted fractions
Hello,
I'm currently writing a program for a java class, and I'm currently having trouble working out an efficient search algorithm. The program is supposed to take a text file and parse it, and any time that it finds a statement of the form (A/B operand X/Y), where A,B,X, and Y are integers, and the operand can be +,-,*, or /. It then takes the statement and creates a Fraction class, for each fraction, and performs the stated operand.
I'm just wondering what the easiest way to recognize this pattern in a text file would be. The only reasonable solution I can think of would be using the next() function to assure that and array of booleans read true for finding the correct types in order, which would be very inefficient.
Any help would be greatly appreciated!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|