Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21f44c8a9506e2a

Jump to content

Talk:Binary expression tree

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 3 years ago by PrimeBOT in topic India Education Program course assignment

Example

[edit]

Untitled

[edit]

The input is: a b + c d e + * *

Expression Tree


Since the first two symbols are operands, one-node trees are created and pointers are pushed to them onto a stack. For convenience the stack will grow from left to right.


Stack growing from Left to Right


The next symbol is a '+'. It pops the two pointers to the trees, a new tree is formed, and a pointer to it is pushed onto to the stack.

Formation of a New Tree


Next, c, d, and e are read. A one-node tree is created for each and a pointer to the corresponding tree is pushed onto the stack.

Creating One-Node Tree


Continuing, a '+' is read, and it merges the last two trees.




Merging Two Trees

Now, a '*' is read. The last two tree pointers are popped and a new tree is formed with a '*' as the root.

Forming a New Tree with a Root


Finally, the last symbol is read. The two trees are merged and a pointer to the final tree remains on the stack.

Steps to Construct an Expression tree a b + c d e + * *

[1] PratikNadagouda (talk) 18:10, 14 September 2011 (UTC)Reply


Saurabh29 (talk) 18:28, 14 September 2011 (UTC)Reply

India Education Program course assignment

[edit]

This article was the subject of an educational assignment at College Of Engineering Pune supported by Wikipedia Ambassadors through the India Education Program during the 2011 Q3 term. Further details are available on the course page.

The above message was substituted from {{IEP assignment}} by PrimeBOT (talk) on 20:13, 1 February 2023 (UTC)Reply

  1. Cite error: The named reference Gopal2010 was invoked but never defined (see the help page).