Reputation: 10 Tradesman
- Contributor w/DIC++
- Active Posts:
- 203 (0.08 per day)
- 16-October 06
- Profile Views:
- Last Active:
- Sep 16 2013 07:59 PM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Dream Kudos:
Posts I've Made
Posted 16 Feb 2012Ok I see how I can do this. Thank you.
Posted 16 Feb 2012Can you explain a little more? I was using the following algorithm to evaluate the postfix expression.
s <-- new stack // holds Integer operands and intermediate results
while expr has more tokens
tok <-- next token in expr
if tok = "+", "-", "*", "/", or "%" // tok is an operator
op2 <-- s.pop()
op1 <-- s.pop()
temp <-- op1 tok op2 // apply operator tok to op1 and op2
s.push(temp) // store intermediate result
else // tok is an operand
tokInt <-- parseInt(tok) // convert tok from String to Integer
Posted 6 Feb 2012Thanks blackcompe! I just replied and meant to address you also. Hopefully I clarified better what my intents are. Thanks again for your help.
Posted 6 Feb 2012Hi Jon,
Thanks for the response. I figured I was heading in the wrong direction but cannot seem to think of it is simpler terms. After I have the unique duplicate lists it seems like I would need to use them to create pairs. I am doing an assignment were ultimately we are creating gibberish after reading in text.
we are asked to find unique words and their counts
then we need to find unique pairs of words where "a comes before b" and "a follows b". There is lot more to the assignment. I am just stuck on how to move forward on finding unique pairs and how this will help create gibberish later. Should I try another type of data structure. I over heard perhaps a multidimensional array, but the only thing is that I thought I would need to store both a string and an int so I went with Hashmaps. I am up for using whatever to get the job done and help me understand how to accomplish making the ab and ba sets/pairs.
Posted 5 Feb 2012I parse some text and store it in a string array called tokens. Then I iterate through the tokens and store them into a hashmap that contains each unique word and the number of times it occurs. I want to use this hashmap to create another hashmap.
private HashMap<HashMap<String,String>,Integer> aPrecedesB
This will store the pairs of words from the string hashmap and the number of times each pair occurs. Well that is what I am attempting anyways.
I am new to hashmaps and am not even sure that this will do what I need it to. I just did not understand any other approach.
- Member Title:
- D.I.C Head
- 35 years old
- May 15, 1978
- Albuquerque, NM
- my wife, programming,reading, golf, working out, video games, and fishing.
- Full Name:
- Julian Apodaca
- Years Programming:
- Programming Languages:
wartech hasn't added any friends yet.