UST Interview Question

Asked a puzzle related to bubble sort