Question: For this assignment you are to take the parse tree, as input and create and print a derivative tree. The derivative tree should be a

For this assignment you are to take the parse tree, as input and create and print a derivative tree. The derivative tree should be a binary tree with the nodes that contain the normal data, left, right, and parent fields.

The derivative of an expression that involves the variable x or X can be defined by a few recursive rules:

If A is an expression, let D(A) be the derivative of A.

The derivative of a constant is 0. D(C) = 0.

The derivative of x or X is 1. D(x) = D(X) = 1.

If A and B are expressions, let D(A) be the derivative of A and D(B) be the derivative of B. Then

The D(A + B) is D(A) + D(B).

The D(A - B) is D(A) - D(B).

The D(A * B) is (A * D(B)) + (B * D(A)).

The D(A / B) is ((B * D(A)) - (A * D(B))) / (B * B) [Extra Credit]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!