|
|
|
|
|
by StillBored
1552 days ago
|
|
Yah, or just store both the forward and backwards links in a single variable by xoring the forward and backward links together and storing it. Then the list traversal direction is picked by selecting either the head or tail and starting the operation. Halves the cost of a doubly linked list, while allowing the same function to be used for forward and backwards traversal. |
|
If it's a balanced tree, you need only log(n) stack entries you can statically provision, and then other threads can traverse the tree at the same time.
Most of the traditional optimizations turned into pessimizations decades back. That has been a good thing.