Identifying increasing and decreasing intervals