defined processSortedArray()