The only input parameter to the maximize algorithm is the identification of the window to be maximized. The only output parameter is the new root of the tree to be used for a screen update. The pseudo-code algorithms of the maximize (Maximize) and return operations (Return) are listed in Appendix .
The maximize algorithm initially climbs up the hierarchy while the current node is a G-Node with only a single child, starting from the window to be maximized, call it W. The algorithm then pushes some fields of the window to be maximized into stacks such as coordinates, identification, index, and parent node to be used later by the return algorithm. The current tree root and the window maximized are also pushed into stacks. A G-Node of opposite type of node W is created as the root of the tree, and W is inserted as the only child of this window. The coordinates of the G-Node is made screen coordinates and the effects of the operation is propagated to lower level windows.
The return algorithm works in a similar fashion by first popping saved window attributes. Then, the current root node type is compared with the window maximized earlier, in case there is any change. If the types do not match a G-Node is created and the current root becomes the only child. Then, either the G-Node or the current root is attached to the old location of the window maximized earlier, at the same index with the same coordinates, etc. The root of the tree is assigned and effects are propagated from the root down to the lower level windows.