Is the main issue to avoid loss of storage space? That is, access time is not that important?
Thomas Den mån 30 dec. 2024 08:28Binyamin Dissen < 00000662573e2c3a-dmarc-requ...@listserv.ua.edu> skrev: > The issue with playing with pointers is that the storage would be lost. > Blocks > have quite variant lengths. > > I guess I could create X areas and release an area when all items in the > area > have been deleted (perhaps transfer items if the remaining count is low). > > On Mon, 30 Dec 2024 06:44:33 +0000 "Farley, Peter" > <0000031df298a9da-dmarc-requ...@listserv.ua.edu> wrote: > > :>Sounds to me like a deque with functions q.popleft() to remove at the > left side, q.append() to add at the right side. Scan process would be a > series of popleft calls with append for the ones being left for a later > time. > :> > :>E.G. (pseudocode): > :> > :>Scan(q) { > :> Curlen = len(q) > :> For qx = 1 to Curlen { > :> Qitem = q.popleft() > :> If Qitem is NOT to be removed { > :> q.append(Qitem) > :> } > :> Else { Process removed Qitem } > :> } > :>} > :> > :>If the “Qitems” are relatively large in size and all at different > addresses then the deque structure (which can be a dynamically sized array) > can just store pointers to the actual items, resulting in not a lot of data > movement at all. > :> > :>FWIW, I have done something like this in COBOL, though not for an > employer. > :> > :>HTH > :> > :>Peter > :> > :>From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On > Behalf Of Binyamin Dissen > :>Sent: Sunday, December 29, 2024 3:51 PM > :>To: IBM-MAIN@LISTSERV.UA.EDU > :>Subject: Ideas of managing a data structure > :> > :> > :>The data structure consists of various items of different lengths. The > items > :> > :>are added serially and periodically the area is scanned where most items > are > :> > :>removed. The remaining items are likely to be removed in a later scan > (with > :> > :>new items). > :> > :> > :> > :>My thought was to have two data areas, and during the scan insert the > :> > :>undeleted items into the alternate area. It will be a bit of data moves > but is > :> > :>simple. > :> > :> > :> > :>Does Knuth talk about such a data structure? > > -- > Binyamin Dissen <bdis...@dissensoftware.com> > http://www.dissensoftware.com > > Director, Dissen Software, Bar & Grill - Israel > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN