Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
marshray
13y ago
0 comments
Save
Share
You have a magic allocator for your list nodes that does better than O(1) amortized?
0 comments
4 comments · 2 top-level
top
newest
oldest
spinlocked
13y ago
· 2 in thread
Do you need magic to create an O(1) allocator for a pool of fixed size objects?
marshray
OP
13y ago
Yes, when (as in the general case of std::list) the number of objects is not known in advance.
spinlocked
13y ago
true. however, libstdc++ implements __pool_alloc for a reason.
shrughes
13y ago
Being better than O(n) worst case is the target here, not O(1) amortized. For example, O(1) amortized and O(log n) worst case is a thing.
j
/
k
navigate · click thread line to collapse