ProAlgos/ProAlgos-Cpp

Documentation for Binary Search Tree

PhysicsUofRAUI opened this issue · 6 comments

Hi. I want to add the documentation for the binary search tree.

Great! Let me know if you have any questions.

I have a question about the space complexity of the iterative tree traversal vs the recursive tree traversal. It seems to me that they should be different, but in the comments in the hpp file, they are listed as the same.

stale commented

This issue has been automatically marked as inactive because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

I have created a pull request with this. I put in the documentation that the space complexity is O(1) for the insert, remove and search. I think that might be wrong since it is different than what was in the comments, but I am not sure why.

Is it because the computer has to keep the whole tree in memory all the time or for some other reason? Sorry for my ignorance about space complexity.

@PhysicsUofRAUI You've got it right. The space complexity is O(1) since a constant amount of extra space is required by these operations. In the comments too the space complexity is O(1) for these operations.

stale commented

This issue has been automatically marked as inactive because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.