首页 > 其他 > 详细

SPOJ #4 Transform the Expression

时间:2014-02-04 23:14:41      阅读:431      评论:0      收藏:0      [点我收藏+]

Not hard to know it is simply transform from in-order to post-order.
My first idea is to build a tree from in-order string and then traverse the tree by post-order - naive so slow.
Subtle stack manipulation solves it - stack only for operators:
http://cs.nyu.edu/courses/Fall12/CSCI-GA.1133-002/notes/InfixToPostfixExamples.pdf

BTW, I love Ruby more.

SPOJ #4 Transform the Expression

原文:http://www.cnblogs.com/tonix/p/3537867.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!