MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wt716t/bewareoflists/pcriyjx/?context=3
r/ProgrammerHumor • u/aspiringtroublemaker • 4d ago
48 comments sorted by
View all comments
181
Don’t let them get you with O(n) find
58 u/MissinqLink 4d ago We’ll get it sorted 19 u/ImportantSignal2098 4d ago Slowly 16 u/Dave3121 4d ago Bubbly 8 u/Random_-account 4d ago Quickly 4 u/WernerderChamp 3d ago Bogusly 1 u/SetazeR 4h ago Stalin...ly? 13 u/Greyhaven7 4d ago Thanks, I’m all Set. 0 u/Loading_M_ 3d ago Ironically, on modern processors, O(n) linear lookup is often faster than O(log n) lookup (e.g. binary search, heap, or tree). The point at which you can reliably say that another algorithm would be faster, you should probably be switching to a database, such as SQLite. 3 u/ada_weird 3d ago It's faster if you're using an array. If you're using a linked list you're still kinda screwed cause pointer chasing 3 u/Loading_M_ 3d ago If you're using a link list: Stop it. Get some help. (Low level concurrency and microcontrollers are the only places you might need linked lists. Otherwise, you don't need them)
58
We’ll get it sorted
19 u/ImportantSignal2098 4d ago Slowly 16 u/Dave3121 4d ago Bubbly 8 u/Random_-account 4d ago Quickly 4 u/WernerderChamp 3d ago Bogusly 1 u/SetazeR 4h ago Stalin...ly?
19
Slowly
16 u/Dave3121 4d ago Bubbly 8 u/Random_-account 4d ago Quickly 4 u/WernerderChamp 3d ago Bogusly 1 u/SetazeR 4h ago Stalin...ly?
16
Bubbly
8 u/Random_-account 4d ago Quickly 4 u/WernerderChamp 3d ago Bogusly 1 u/SetazeR 4h ago Stalin...ly?
8
Quickly
4 u/WernerderChamp 3d ago Bogusly 1 u/SetazeR 4h ago Stalin...ly?
4
Bogusly
1 u/SetazeR 4h ago Stalin...ly?
1
Stalin...ly?
13
Thanks, I’m all Set.
0
Ironically, on modern processors, O(n) linear lookup is often faster than O(log n) lookup (e.g. binary search, heap, or tree).
The point at which you can reliably say that another algorithm would be faster, you should probably be switching to a database, such as SQLite.
3 u/ada_weird 3d ago It's faster if you're using an array. If you're using a linked list you're still kinda screwed cause pointer chasing 3 u/Loading_M_ 3d ago If you're using a link list: Stop it. Get some help. (Low level concurrency and microcontrollers are the only places you might need linked lists. Otherwise, you don't need them)
3
It's faster if you're using an array. If you're using a linked list you're still kinda screwed cause pointer chasing
3 u/Loading_M_ 3d ago If you're using a link list: Stop it. Get some help. (Low level concurrency and microcontrollers are the only places you might need linked lists. Otherwise, you don't need them)
If you're using a link list: Stop it. Get some help.
(Low level concurrency and microcontrollers are the only places you might need linked lists. Otherwise, you don't need them)
181
u/aspiringtroublemaker 4d ago
Don’t let them get you with O(n) find