In the bingo sort variant, items are sorted by repeatedly looking through the remaining items to find the greatest value and moving "all" items with that value to their final location. Like counting sort, this is an efficient variant if there are many duplicate values: selection sort does one pass through the remaining items for each "item" moved, while Bingo sort does one pass for each "value". After an initial pass to find the greatest value, subsequent passes move every item with that value to its final location while finding the next value as in the following pseudocode (arrays are zero-based and the for-loop includes both the top and bottom limits, as in Pascal):