A sorting circuit for sorting a plurality of reference-axis data, each consisting of a plurality of digits in accordance with a datum number given to each of said reference-axis data, said sorting circuit comprising:
- a reference-axis data memory for storing said reference-axis data with their datum numbers;
- a datum number pointer for outputting a datum number to said reference-axis data memory as a read-out address and to read the lowest searched digit of each of said reference-axis data from said reference-axis memory in the order following the datum numbers;
- a first buffer memory including first datum number storage areas each of which can be addressed based on one of the reference-axis data having a given searched digit and outputted from said reference-axis data memory and for storing a datum number from said address pointer when the corresponding reference-axis datum is initially inputted from said reference-axis data memory into one of said first datum number storage areas;
- a last buffer memory including last datum number storage areas each of which can be addressed based on one of the reference-axis data having a given searched digit and outputted from said reference-axis data memory, said last buffer memory being adapted to update a datum number stored in one of the last datum number storage areas into a datum number from said address pointer at each time when the corresponding reference-axis datum is read out from said reference-axis data memory at its storage area;
- a chain buffer memory including chain datum number storage areas which can be addressed by the datum numbers;
- a first control means for writing a newly updated datum number into a chain datum number storage area addressed by a before-updated datum number at each time when the datum number of said last buffer memory is updated;
- a second control means, which is operative after the writing of data into said first and last buffer memories has terminated, for writing a datum number stored in each one of said first datum number storage areas and placed in a predetermined relationship with said datum number of said last datum number storage area into said chain datum number storage area, said datum number storage area addressed by the datum number stored in the last datum number storage area, whereby the datum numbers of the reference-axis data can be written into the chain datum number storage areas to chain said reference-axis data with each other in the ascending or descending order;
- a fourth control means for setting the next higher searched digit of a reference-axis datum and for reading the datum numbers from said chain datum number storage areas in accordance with a predetermined read-out rule, said fourth control means being adapted to perform the sorting operation of each of the searched digits such that the set searched digits of said reference-axis data are outputted from said reference-axis data memory to each of said first and second buffer memories in the order following their datum numbers, said sorting operation being repeated while shifting the searched digits by one digit in the order starting from the lowest digit of the reference-axis data and terminating at the highest digit thereof;
- and
- a third control means operative such that after the highest searched digit has been sorted, the datum numbers written in said chain datum number storage areas being read out therefrom in a predetermined read-out rule, whereby said reference-axis data can be sorted and outputted from said reference-axis data memory in the order following their datum numbers.