The present application relates to a device for selecting top values from a set of raw values, comprising: an output
queue, a loop
queue, a top value storage module and a control module. The control module is configured to, at a higher priority, merge the intermediate sequence stored in the loop
queue with the at most N top values stored in a
storage area of the top value storage module, and sort the merged values to generate a merged sequence, until a predetermined number of storage areas in the top value storage module are traversed; wherein the control module is further configured to, when there is no intermediate sequence being stored in the loop queue, merge the output sequence with the at most N top values stored in a
storage area of the top value storage module, and sort the merged values to generate a merged sequence; wherein the control module is further configured to provide a first subsequence in the merged sequence which is closer to a top most value of the merged sequence to the top value storage module to update the top value storage module, and provide a second subsequence in the merged sequence which is farther away from the top most value of the merged sequence to the loop queue to generate or update the intermediate sequence.