total_swaps to keep track of the total number of swaps.level_values.
c. For each node at this level, add its children to the queue.
d. Sort the level_values list to find the sorted order.
e. Count the number of swaps needed to sort the original sequence of level_values and add it to total_swaps.total_swaps as the result.