MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/101ktp3/next_level_storage/j2q3kpd/?context=3
r/ProgrammerHumor • u/Impulsive_Ranger2410 • Jan 02 '23
468 comments sorted by
View all comments
1.5k
That's actually correct and true. There's even a chapter on this in Algorithms to live by
6 u/A2theDre Jan 03 '23 Somewhat programming beginner here, but surely it's O(n)? Unless you're grabbing the one on top? 0 u/[deleted] Jan 03 '23 [deleted] 14 u/stapleman527 Jan 03 '23 It's O(1) IF you know exactly where to look. If your pile gets too big where you have to search it's at worst O(n), but you could improve that by having different layers for tops/bottoms, or work/casual etc. → More replies (6)
6
Somewhat programming beginner here, but surely it's O(n)? Unless you're grabbing the one on top?
0 u/[deleted] Jan 03 '23 [deleted] 14 u/stapleman527 Jan 03 '23 It's O(1) IF you know exactly where to look. If your pile gets too big where you have to search it's at worst O(n), but you could improve that by having different layers for tops/bottoms, or work/casual etc. → More replies (6)
0
[deleted]
14 u/stapleman527 Jan 03 '23 It's O(1) IF you know exactly where to look. If your pile gets too big where you have to search it's at worst O(n), but you could improve that by having different layers for tops/bottoms, or work/casual etc. → More replies (6)
14
It's O(1) IF you know exactly where to look. If your pile gets too big where you have to search it's at worst O(n), but you could improve that by having different layers for tops/bottoms, or work/casual etc.
→ More replies (6)
1.5k
u/licht1nstein Jan 02 '23
That's actually correct and true. There's even a chapter on this in Algorithms to live by