Implemented the firs part of exercise 3.3 (histogram)