Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ1010
Page ↗
Q1010FWASIC interview problem

Bubble sort in place

TechniquesSortingDynamic arrayIn place
DifficultyEasy
TopicArrays
LanguageSystemVerilog
Requirements3 checkpoints
01

Problem

Sort a dynamic array of integers in ascending order using bubble sort.

Example input and output

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

Adjacent out-of-order pairs are exchanged until a pass performs no swaps.

02

Requirements (3)

  • Modify the input array in place.
  • Stop early when a full pass performs no swaps.
  • Handle empty and one-element arrays.