Message Queue Partitioning Problem #11
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Analysis #05 — Message Queue Partitioning
Problem
A communication subsystem maintains a singly linked intrusive queue of outgoing messages.
Each message contains a transmission identifier, a retry flag, and a pointer to the next message:
After a transmission attempt, some messages may need to be retried.
Partition the original queue into two separate queues:
The relative order of messages must be preserved in both queues.
Requirements
O(n)time.Example
Input
Message state:
Result
Ready queue:
Retry queue:
The original queue is consumed during the operation, and every message must belong to exactly one of the two resulting queues.