Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Quicksort a dynamic array

Hardware interview practice

Quicksort a dynamic array

MediumArraysSystemVerilog

Sort a dynamic array of integers in ascending order using recursive quicksort.

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
values = [7, 2, 9, 2, 5]
Expected output
[2, 2, 5, 7, 9]

Partitioning places the pivot in its final position and recursively sorts the two bounded subranges.

What to cover

Requirements

  1. Partition each range around one pivot.
  2. Recurse only on valid subranges.
  3. Modify the input array in place.
asic.fyi · Learn silicon end to end.info@asic.fyi