1. Run-length encoding
Try firstEncode the row black, black, black, white, white, white, white, white. Why is run-length encoding called lossless?
Check your answer
0, 3, 5. Decompressing gives back exactly the same data.
Compression stores data in fewer numbers, so it takes less space and is quicker to send. Run-length encoding stores the length of each run of the same colour, taking turns from white: 3 white, 4 black, 1 white is 3, 4, 1. A row that starts black begins with 0.
Decoding the codes gives back exactly the same picture, so it is lossless. It saves a lot when there are long runs and nothing (or worse) when the colour changes every pixel.

