codezonediitj / pydatastructs

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

Add `ImplicitArray` #457

Open czgdp1807 opened 2 years ago

czgdp1807 commented 2 years ago

Description of the problem

As of now in OneDimensionalArray and subclasses we store all the data explicitly in memory. ImplicitArray will just store a function object. This function object will return values for different indices. That way the memory requirement will be reduced to a constant. This will be useful for cases where search algorithms don't need an explicit array but a range and some values associated with that range.

Example of the problem

References/Other comments

hassanrahim26 commented 2 years ago

Hey, @czgdp1807 I want to work on this issue. Can you please tell me ways to get started?

czgdp1807 commented 2 years ago

Sure go ahead. Well it's about adding new classes (ImplicitArray, OneDimensionalImplicitArray) in arrays.py with same interface (methods in simpler terms) as Array, OneDimensionalArray. There is a lot of code in arrays.py which you can go through and follow the same pattern for adding implicit arrays.

hassanrahim26 commented 2 years ago

So, do I've to create a new class like this:-

class ImplicitArray(Array):
    pass

class OneDimensionalImplicitArray(ImplicitArray, OneDimensionalArray):
    "Here I've to declare the functions of this class"
czgdp1807 commented 2 years ago

Yeah exactly. In fact, the classes you have inherited seems about right.

hassanrahim26 commented 2 years ago

Alright then. I'll work on this issue and I'll create a PR for this.

NIveX2169 commented 1 year ago

hi can you assign me this issue under GSSOC23 .