Skip to content

New approach to the arithmetic expressions evaluating. Performance comparison with the standard algorithm.

License

Notifications You must be signed in to change notification settings

sasamil/evaluating-arithmetic-expression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 

Repository files navigation

Evaluating arithmetic expressions - reverse recursive algorithm

New approach to the arithmetic expressions evaluating. Performance comparison with the classical approach (Dijkstra's Shunting-Yard).

This example demonstrate performance gains when evaluationg arithmetic expressions by the algorithm which has been explained in the parsing-arithmetic-expression repository.

So, these performance comparisons have been made here:
(a) Classical approach   vs.   (b) new-algorithm-1   vs.   (c) new-algorithm-2

In other words:
(Shunting-Yard -> RPN -> evaluation)  vs.  (new-algorithm -> RPN -> evaluation)  vs.  (new-algorithm -> in-place evaluation)

It turns out that (b) is faster than (a) and (c) is faster than (b). Moreover, (c) is for a magnitude faster than (a).

Finally, I would like to emphasize - this new approach is good not only because it is faster. I find it scallable as well! It should be very simple to add new operators and rules. I find it fairly simple, with a clear idea behind it. (Note that the evaluation can be done in-place, without a need for intermediary data structures.)

About

New approach to the arithmetic expressions evaluating. Performance comparison with the standard algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages