Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Merge sorted transaction queues

Hardware interview practice

Merge sorted transaction queues

EasyReference ModelsSystemVerilog

Merge two queues of transactions sorted by id into one stable sorted queue.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
queue A=[(id1,A1),(id3,A3)]; queue B=[(id1,B1),(id2,B2),(id3,B3)]
Expected output
merged=[A1,B1,B2,A3,B3]

On equal IDs the first queue wins, preserving stable order while neither input queue is mutated.

What to cover

Requirements

  1. Prefer the first queue when ids are equal.
  2. Do not mutate the input queues.
  3. Append every remaining transaction.
asic.fyi · Learn silicon end to end.info@asic.fyi