Added findCriticalPoints

finds critical points in a vector (local max and min)