I'm doing a homework for algorithm class where I have to show what a particular array looks like at each step of the quick sort algorithm, in a manner similar to this image: (page from CLRS book).

I would like to know how to draw an array that looks like the one in the book. In particular, I want to know how to (in order from most to least important)
Draw an array.
Put letter(s) above a node or a blank space.
Draw the black bars that partition the array.
Customize a cell with gray or light gray color.
