โ† Amazon questions

Multi-threaded Queue Enqueue

Filed under Amazon

Free read 1 of 3

Define a Node class and a Queue class with head/tail pointers.

The question

Implement a thread-safe Enqueue operation for a queue using a linked list, ensuring atomic updates to the head and tail pointers.

Constraints

  • Must handle concurrent access
  • Minimize lock contention
  • Use standard threading primitives

Approach

  1. Define a Node class and a Queue class with head/tail pointers.

Tips

  • What they are testing: Focuses on race conditions during pointer updates.
  • Common mistake: Holding a lock for too long or failing to handle the empty queue case correctly.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.