Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ239
Page ↗
Q239FWASIC interview problem

Quicksort a dynamic array

TechniquesSortingPartitionRecursion
DifficultyMedium
TopicArrays
LanguageSystemVerilog
Requirements3 checkpoints
01

Problem

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

Example input and output

Use this case to check your interpretation
Input
values = [7, 2, 9, 2, 5]
Output
[2, 2, 5, 7, 9]
Explanation

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

02

Requirements (3)

  • Partition each range around one pivot.
  • Recurse only on valid subranges.
  • Modify the input array in place.