z****e 发帖数: 2024 | 1 You are asked to design a map like data structure, which support look_up
by ID, remove by ID and FIFO look_up and FIFO remove.
FIFO stands for first in and first out.
How would to do it?
Thanks. | h****8 发帖数: 599 | 2 can u define what is FIFO look up ? | b********h 发帖数: 119 | 3 Does that mean it is both a map and a queue? If so, I guess you can augment
a binary search tree. keep a pointer between the elements pushed into this
data structure to maintain the queue structure.
【在 z****e 的大作中提到】 : You are asked to design a map like data structure, which support look_up : by ID, remove by ID and FIFO look_up and FIFO remove. : FIFO stands for first in and first out. : How would to do it? : Thanks.
| j******n 发帖数: 271 | 4 linked list + map
template
struct FifoWithKeyLookup {
list l;
map m;
}; |
|