$a)$ Bubble sort
Source : https://en.wikipedia.org/wiki/Bubble_sort
$[2,2,\fbox{2},\underbrace{1,1,1,1,1,0,0,0,0}]$
$\downarrow$ After $9$ swaps
$[2,2,1,1,1,1,1,0,0,0,0,2]$
$\downarrow$ Similarly After $18$ swaps
$[1,1,1,1,\fbox{1},\underbrace{0,0,0,0},2,2,2]$
$\downarrow$ After $4$ swaps
$[1,1,1,1,0,0,0,0,1,2,2,2]$
$\downarrow$ Similarly After $16$ swaps
$[0,0,0,0,1,1,1,1,1,2,2,2]$
$9+9+9+4+4+4+4+4=47$ Swaps
$b)$
$[2,2,2,1,1,1,1,1,0,0,0,0]$