Question: Design Patterns Expression trees consist of nodes containing operators and operands. Operators have different precedence levels, different associativities and different arities, e.g. multiplication takes precedence

Design Patterns Expression trees consist of nodes containing operators and operands. Operators have different precedence levels, different associativities and different arities, e.g. multiplication takes precedence over addition. The multiplication operator has two arguments, whereas unary minus operator has only one. Operands are integers, double, variables, etc. We'll just handle integer in this question. Expression trees may be "evaluated" via different traversal: e.g. In-order, post-order, pre-order, level-order. The evaluation step may perform various operations: traversal and print the expression tree, return the "value" of the expression tree generate code and perform semantic analysis Consider the example of an expression tree given below: Binary Unary node +nodes 5 4 3 Integer nodes Instead of using an adhoc data driven design approach, it has been decided to use design patterns Specify from the list below of the design pattern(s), that is the one or the ones, that could be effectively used in this application. You must justify your decision a) *factory method *abstract factory builder adapter composite *decorator *command observer strategy Design Patterns Expression trees consist of nodes containing operators and operands. Operators have different precedence levels, different associativities and different arities, e.g. multiplication takes precedence over addition. The multiplication operator has two arguments, whereas unary minus operator has only one. Operands are integers, double, variables, etc. We'll just handle integer in this question. Expression trees may be "evaluated" via different traversal: e.g. In-order, post-order, pre-order, level-order. The evaluation step may perform various operations: traversal and print the expression tree, return the "value" of the expression tree generate code and perform semantic analysis Consider the example of an expression tree given below: Binary Unary node +nodes 5 4 3 Integer nodes Instead of using an adhoc data driven design approach, it has been decided to use design patterns Specify from the list below of the design pattern(s), that is the one or the ones, that could be effectively used in this application. You must justify your decision a) *factory method *abstract factory builder adapter composite *decorator *command observer strategy
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
