Cosmos: No output in tree.py

Created on 26 Mar 2018  路  3Comments  路  Source: OpenGenus/cosmos

This is a(n):

  • [ ] New algorithm
  • [ ] Update to an existing algorithm
  • [x] Error
  • [ ] Proposal to the Repository

Details:
tree.py does not give any output.

Most helpful comment

You can work on this issue.

All 3 comments

Is anyone working on this issue?

You can work on this issue.

I don't think this has necessarily been solved so I'll make a pull-request that has modified the file so that it can print specific insertions, deletions, and print the tree itself.

Explanation:
For example, it takes in an input_file.txt containing i6 i8 i3 i1 i9 i5 i2 d1 d5 p.
i6 means insert 6, d1 means delete 1, and p means print the nodes. The printing in this case uses the traversal in the original implementation and outputs the nodes and their relations under the "BST representation" heading. Example below.

The output of the above test case would be:
root: 6
Insert: 8
8 goes right (parent: 6)
Insert: 3
3 goes left (parent: 6)
Insert: 1
1 goes left (parent: 6)
1 goes left (parent: 3)
Insert: 9
9 goes right (parent: 6)
9 goes right (parent: 8)
Insert: 5
5 goes left (parent: 6)
5 goes right (parent: 3)
Insert: 2
2 goes left (parent: 6)
2 goes left (parent: 3)
2 goes right (parent: 1)
Delete: 1
Delete: 5

BST representation
6
left next level: 3
right, next level: 8
3
left next level: 2
8
right, next level: 9
2
leaf
9
leaf

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grantmwilliams picture grantmwilliams  路  4Comments

arnavb picture arnavb  路  3Comments

tbhaxor picture tbhaxor  路  4Comments

rhendz picture rhendz  路  4Comments

athangkanos picture athangkanos  路  4Comments