url@feddit.fr to Microblog Memes@lemmy.worldEnglish · 6 months agoI also have onemedia.feddit.frimagemessage-square13linkfedilinkarrow-up1586arrow-down115
arrow-up1571arrow-down1imageI also have onemedia.feddit.frurl@feddit.fr to Microblog Memes@lemmy.worldEnglish · 6 months agomessage-square13linkfedilink
minus-squaregrue@lemmy.worldlinkfedilinkEnglisharrow-up38·6 months agoYou want to think your pile is O(1) for retrieval, but it’s actually O(n). Meanwhile, the closet actually is O(1) for retrieval, but you don’t want to spend the time for the bulk insert it requires beforehand.
minus-squaretetris11@feddit.uklinkfedilinkEnglisharrow-up11·6 months ago O(n) worst case O(log(n)) average case O(1) best case O(2) median case That last one: it’s a LIFO stack. You might not immediately wear what you threw on last night, but probably would wear the thong under that
minus-squaresocsa@piefed.sociallinkfedilinkEnglisharrow-up6·6 months agoYeah I was going to say - unless your pile is ordered and indexed then it is not a cache and is more like random access.
minus-squaregrue@lemmy.worldlinkfedilinkEnglisharrow-up3·6 months agoA pile is a messy stack, with access to push and pop only from the top. It is ordered (from the top down), but not indexed.
minus-squareNoodle07@lemmy.worldlinkfedilinkEnglisharrow-up2·6 months agoNow if you store things in vertical stacks only accessible from above… Yeah I keep my clothes on the drying rack so I spend 0 time storing anything lol
minus-squaretauonite@lemmy.worldlinkfedilinkEnglisharrow-up2·6 months agoMy pile of chairs on my clothe has a constant size. O(1) baby!
You want to think your pile is O(1) for retrieval, but it’s actually O(n).
Meanwhile, the closet actually is O(1) for retrieval, but you don’t want to spend the time for the bulk insert it requires beforehand.
That last one: it’s a LIFO stack. You might not immediately wear what you threw on last night, but probably would wear the thong under that
Yeah I was going to say - unless your pile is ordered and indexed then it is not a cache and is more like random access.
A pile is a messy stack, with access to push and pop only from the top. It is ordered (from the top down), but not indexed.
Now if you store things in vertical stacks only accessible from above… Yeah I keep my clothes on the drying rack so I spend 0 time storing anything lol
My pile of chairs on my clothe has a constant size. O(1) baby!