Your task is to complete the implementation of a class that analyzes the peaks and valleys in a data set.

A peak is a value that is larger than the values before and after. A valley is a value that is smaller than the values before and after. The first and last values are neither peaks nor valleys. In other words, a peak or valley occurs if the curve changes direction (from up to down or from down to up).