Python Forum
my new adt, what should i name it - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: my new adt, what should i name it (/thread-22876.html)



my new adt, what should i name it - Skaperen - Dec-01-2019

i'm making a new abstract data type. it might exist, already. it is a list that expands as items are stored to it. if the location already exists, it replaces what is there. it not, it expands the list (virtually). you can get what's there at any time. it keeps data in a sparse way, allowing the caller to see extents of data and holes, including the highest and lowest extents. can you tell me what to name this or what the existing name is?


RE: my new adt, what should i name it - Larz60+ - Dec-01-2019

a list that expands: it's called append


RE: my new adt, what should i name it - Skaperen - Dec-01-2019

but with this one, you can store into any position even beyond its current length.

skaplist.store(data,1000000) puts data at position 1000000 leaving a sparse gap up to there. it will also do negative positions.

i think i will implement it with a tree structure.


RE: my new adt, what should i name it - nilamo - Dec-12-2019

What's important for the structure? Iterating over it? Or just random read/writes?

If the important part is just random read/writes, then it sounds like a dict, but the "index" is just the dict key.


RE: my new adt, what should i name it - Skaperen - Dec-13-2019

there will mostly be ranges of indexes being filled. that is it might put data into [64] through [255]. there might also be negative ranges. it might leave out every Nth item in a few cases (if this overlaps, then previous data remains in those "holes"). the underlying implementation might be a dictionary or something more optimal in the future.

once it is filled in, access is mostly in a similar sequence as before ... same ranges in different orders.

an "infinite" list would work. if accessing an index that was never filled in, it gets the established default.