Encoding a list of numbers using gamma coding I'm trying to work out how to find the gamma $\gamma -code$ that encodes the postings list (12, 18, 21, 22).

Is the postings list encoded just by a list of the individual $\gamma$-codes for each integer? E.g. for 12 the gamma code is: 0001100, and so the first entry in the $\gamma$-code for the pointing list is just 0001100. Or is there another representation - am I thinking along the right lines?

Thanks in advance for any help!
I'm assuming that you're referring to the Elias gamma code. This code is a prefix code, also known as a self-terminating code. This means that you can encode a sequence of numbers by simply concatenating the encodings of the individual numbers. Since the code is self-terminating, the concatenated encoding can be decoded into the encodings of the individual numbers.

A prefix code is a code in which no codeword is a prefix of another codeword. This allows you to decode the list as follows. Read bits until you reach a prefix of the encoding which constitutes a codeword. This encodes the first number. Remove and repeat.

Finally, let me stress that the Elias gamma code is a way of encoding numbers using a string of bits. When you write 0001100, you should think of it as a string of 7 bits. Eventually these bits will be decomposed into 8-bit chunks (knows as bytes) and stored or communicated in this way – as a string of bytes.