The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > General Programming > Java


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags: , , , , , , ,

Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 08-13-2007, 07:52 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Icon13 Postfix, Infix, and Prefix Calculator - Please Help!!!

Hopefully the sample of input below is pretty self explanatory:

java calc.Calculator prefix + x 8 8 x 6 6
Infix = 8 x 8 + 6 x 6
Postfix = 8 8 x 6 6 x +
Result = 100

java calc.Calculator infix 2 – ( 6 + 9 ) / 3
Prefix = - 2 / + 6 9 3
Postfix = 2 6 9 + 3 / -
Result = -3

java calc.Calculator postfix 4 9 + 6 5 – x
Prefix = x + 4 9 – 6 5
Infix = (4 + 9) x (6 – 5)
13

Basically I need to create the output below the first line of each sample input. Of course, I'm planning to use Binary Tree to do this... I actually figured out an interesting stuff out of this sample output... Although, I haven't actually found the algorithm to solve the insert() method for the BinaryTree implementation. Anyways, I found out that the root is at the first index for the Prefix, Index/2 for the Infix, and Array.Length-1 for the postfix... I'm just wondering if anybody can suggest me implementation ideas...

__________________
PHP Code:
System.out.println("Hello World!"); 

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
  #2 (permalink)  
Old 11-12-2007, 11:23 AM
cheungy cheungy is offline
Novice
Join Date: Nov 2007
Posts: 4
iTrader: (0)
cheungy is on a distinguished road
i will love to see those code too =/

__________________

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
  #3 (permalink)  
Old 11-12-2007, 11:31 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
O_o I thought you've seen it already..?

__________________
PHP Code:
System.out.println("Hello World!"); 

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
  #4 (permalink)  
Old 11-12-2007, 01:50 PM
cheungy cheungy is offline
Novice
Join Date: Nov 2007
Posts: 4
iTrader: (0)
cheungy is on a distinguished road
where ?
the other post ?

isnt that only convert infix to postfix ?

__________________

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
  #5 (permalink)  
Old 11-12-2007, 02:01 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
I'd say that prefix and postfix are the easiest, to give a little clue on this, you may want to check and play around with Queue and Stacks

__________________
PHP Code:
System.out.println("Hello World!"); 

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
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 05:43 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50