Skip to content

print method for BinaryTree is based on recursion #104

@zrwusa

Description

@zrwusa

Describe the bug
The current print method for BinaryTree is based on recursion. An iterative implementation is necessary to avoid potential stack overflows.

To Reproduce
const bst = new BST()
for (let i = 1; i <= SYSTEM_MAX_CALL_STACK; i++) bst.add(i);
bst.print()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions