pydatastructs
pydatastructs copied to clipboard
Allow using array for constructing binary trees
Description of the problem
Idea of using arrays for constructing binary trees originated from https://github.com/codezonediitj/pydatastructs/issues/38#issuecomment-562864441 which uses arrays for constructing binary heaps.
The challenge is to make the change without breaking existing API. One approach can be using keyword arguments like, elements
and the transformed API would look like,
def __new__(cls, key=None, root_data=None, comp=None,
is_order_statistic=False, *args, **kwargs):
If the above is done then the existing tests for binary_trees.py can be shortened.
Example of the problem
References/Other comments
This can be done by passing the array of elements and in __new__
we can insert every element of passed array in object.tree
, right?
Yes we can do that. A PR would be better for explaining the solution.
@akshaygoelakki Feel free to start your work on this. Whenever you will create a PR, it will be linked to this issue and it will show up in assignee section.
I want to work on this issue. So kindly assign this issue to me .
@czgdp1807 Could you please provide the link for this code where the changes are to be made?
i would like to work on this issue
You have it! Start working.
I would like to work on this issue, @czgdp1807 kindly assign it to me!
@dollyjain51099 We don't assign issues to contributors. Anyone can work on any issue. Link the PR you open with this issue.