Tracing Associative shape algorithm

suppose for a given formula : a1 - a2 + a3 * a4 / a5/ a6 - a7 + a8 * a9

let us apply default precedence in VB.net and C++ and C# and Php and Java......................etc.

* <=> / highest precedence from left to right equally.

+ <=> - lowest precedence in formula from left to right equally.

now is the solution:

  • a1 - a2 + (a3 * a4) / a5/ a6 - a7 + a8 * a9
  • a1 - a2 + ((a3 a4) / a5 ) /a6 - a7 + a8 * a9
  • a1 - a2 + (((a3 a4) / a5 )/a6) -a7 + a8 * a9
  • a1 - a2 + (((a3 a4) / a5 )/a6) -a7 + (a8 * a9)
  • (a1 - a2) + (((a3 a4) / a5 )/a6) -a7 + (a8 * a9)
  • (a1 - a2) + (((a3 a4) / a5 )/a6) -a7 + (a8 * a9)
  • (a1 - a2) + ( (((a3 a4) / a5 )/a6) -a7 ) + (a8 * a9)
  • (a1 - a2) +( ( (((a3 a4) / a5 )/a6) -a7 ) + (a8 * a9) )
  • becomes two objects finisihed here
  • don't forget the object is
  • parenthesized and element
  • element and parenthesized
  • element and element
  • parenthesized and parenthesized
  • check it in previous program if they are quall
  • much quicker than stack and prefix and infix and postfix
  • thanks []


要查看或添加评论,请登录

Nedal AbuRuqaya的更多文章

社区洞察

其他会员也浏览了