codezonediitj / pydatastructs

A python package for data structures and algorithms
https://pydatastructs.readthedocs.io/en/stable/
Other
199 stars 270 forks source link

Allow using array for constructing binary trees #39

Open czgdp1807 opened 4 years ago

czgdp1807 commented 4 years ago

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

23umesh commented 4 years ago

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?

czgdp1807 commented 4 years ago

Yes we can do that. A PR would be better for explaining the solution.

czgdp1807 commented 4 years ago

@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.

nikipr1999 commented 4 years ago

I want to work on this issue. So kindly assign this issue to me .

Jahnavi-Jonnalagadda commented 4 years ago

@czgdp1807 Could you please provide the link for this code where the changes are to be made?

ayushi-get commented 3 years ago

i would like to work on this issue

sidhu1012 commented 3 years ago

You have it! Start working.

dollyjain51099 commented 3 years ago

I would like to work on this issue, @czgdp1807 kindly assign it to me!

czgdp1807 commented 3 years ago

@dollyjain51099 We don't assign issues to contributors. Anyone can work on any issue. Link the PR you open with this issue.