cross-posted from: https://feddit.fr/c/lemmyshitpost/p/406365/i-also-have-one
cross-posted from: https://feddit.fr/c/microblogmemes/p/226650/i-also-have-one
You must log in or register to comment.
it really only has a time complexity of O(1) for the first few items though. beyond that it increases to O(n) again
Well you’re supposed to keep the structure an array, not let it become a stack.
Unfortunately, though the reserved memory is sequential, the order in which items are added is pseudorandom, and gravity prevents random access, so you would still need a linear search of O(n) time to find any given item.




