(self)
return result
Conducts an inorder traversal of the merge tree.

        The inorder traversal returns the nodes on the last level in the order
        they should be drawn so that no edges cross each other.

        @return: the result of the inorder traversal in a list.
Conducts an inorder traversal of the merge tree.
Conducts an inorder traversal of the merge tree .
def _traverse_inorder(self):
        """Conducts an inorder traversal of the merge tree.

        The inorder traversal returns the nodes on the last level in the order
        they should be drawn so that no edges cross each other.

        @return: the result of the inorder traversal in a list."""
        result = []
        seen_nodes = set()

        for node_index in reversed(range(self._nitems + self._nmerges)):
            if node_index in seen_nodes:
                continue

            stack = [node_index]
            while stack:
                last = stack.pop()
                seen_nodes.add(last)
                if last < self._nitems:
                    # 'last' is a regular node so the traversal ends here, we
                    # can append it to the results
                    result.append(last)
                else:
                    # 'last' is a merge node, so let us proceed with the entry
                    # where this merge node was created
                    stack.extend(self._merges[last - self._nitems])

        return result
def _traverse_inorder ( self ) : result = [ ] seen_nodes = set ( ) for node_index in reversed ( range ( self . _nitems + self . _nmerges ) ) : if node_index in seen_nodes : continue stack = [ node_index ] while stack : last = stack . pop ( ) seen_nodes . add ( last ) if last < self . _nitems : # 'last' is a regular node so the traversal ends here, we # can append it to the results result . append ( last ) else : # 'last' is a merge node, so let us proceed with the entry # where this merge node was created stack . extend ( self . _merges [ last - self . _nitems ] ) return result