Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Tree representation and traversal


1. Tree representation and traversal

2. Tree representation

3. Logical expression
This page looks at how logical expressions can be represented and traversed using JavaScript code.

The (fully parenthesized) logical expression is as follows.
( X & Y ) | ( ( ! X ) & ( ! Y ) )


4. Code conventions
The following code examples use the following. Note: All tree lists are the same, but could not be easily separated for this page.

5. Code examples
The following code examples are provided. Study each one to understand how it works.

6. JavaScript code
Here is the JavaScript code.


7. JavaScript output
Here is the output of the JavaScript code.


8. JavaScript code
Here is the JavaScript code.


9. JavaScript output
Here is the output of the JavaScript code.


10. JavaScript code
Here is the JavaScript code.


11. JavaScript output
Here is the output of the JavaScript code.


12. JavaScript code
Here is the JavaScript code.


13. JavaScript output
Here is the output of the JavaScript code.


14. JavaScript code
Here is the JavaScript code.


15. JavaScript output
Here is the output of the JavaScript code.


16. JavaScript code
Here is the JavaScript code.


17. JavaScript output
Here is the output of the JavaScript code.


18. End of page