US3662402A - Data sort method utilizing finite difference tables - Google Patents

Data sort method utilizing finite difference tables Download PDF

Info

Publication number
US3662402A
US3662402A US95205A US3662402DA US3662402A US 3662402 A US3662402 A US 3662402A US 95205 A US95205 A US 95205A US 3662402D A US3662402D A US 3662402DA US 3662402 A US3662402 A US 3662402A
Authority
US
United States
Prior art keywords
sequence
difference
entry
difference table
items
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
US95205A
Inventor
Kenneth L Bond
James A Schooley
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bull HN Information Systems Italia SpA
Bull HN Information Systems Inc
Original Assignee
Honeywell Information Systems Italia SpA
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honeywell Information Systems Italia SpA filed Critical Honeywell Information Systems Italia SpA
Application granted granted Critical
Publication of US3662402A publication Critical patent/US3662402A/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/22Arrangements for sorting or merging computer data on continuous record carriers, e.g. tape, drum, disc
    • G06F7/24Sorting, i.e. extracting data from one or more carriers, rearranging the data in numerical or other ordered sequence, and rerecording the sorted data on the original carrier or on a different carrier or set of carriers sorting methods in general
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99937Sorting

Definitions

  • Sorting may be defined as the process of arranging a set of information items in a uniform sequence as determined by the magnitudes of the individual items. See Richards, R.K., Arithmetic Operations in Digital Computers, D. Van Nostrand Co., Inc., 1955, page 295. Sorting is one of the basic data processing functions and is used in a variety of applications. For example, sorting is used for maintenance of business files such as inventory records and payroll records, for study and analysis of statistical data, for visual computer output such as printouts or CRT displays, and for maintenance of a data processing systems own internal data file.
  • any sorting method which is to be used in a data processing system be simple and efficient, i.e., that the method include few instructions or steps so that very little system memory is required to store the program implementation of the method and that the running time of the program implementation on the data processing system be as short as possible.
  • FIG. 1A, 1B, and 1C show a flow diagram representing a specific illustrative machine algorithm for practicing data processing in accordance with the present invention
  • FIG. 2A shows an arbitrary sequence of n numbers which are to be sorted
  • FIG. 2B shows the difference table generated for the sequence of numbers of FIG. 2A
  • FIG. 2C shows which of the entries of the difference table of FIG. 2B are negative differences
  • FIGS. 3A and 3B, and 3C show an illustrative computer program for implementing the algorithm represented in FIGS. 1A through 1C.
  • the method of the present invention utilizes the so-called difference table," well-known in the field of mathematics.
  • a difference table for a sequence of n numerically valued items is calculated by subtracting the first item in the sequence from the second, the second item in the sequence from the third, etc. until n-1 such differences are obtained.
  • These differences comprise the first column of the difference table ordered in the order in which they were obtained, i.e., the difference between the first and second items of the sequence being the first entry in the column, the difference between the second and third items of the sequence being the second entry in the column, etc.
  • the differences between successive entries of this first column are then calculated to obtain the second column of the difference table.
  • the process of obtaining the differences between entries of each column is continued until a final column containing but one entry is obtained.
  • the entries of the difference table are generally represented by the symbol A where m designates the mth column of the difference table and k designates the kth entry of the column. Thus, A represents the kth entry of the mth column of a difference table.
  • the first step of the specific illustrative embodiment of the present invention shown in FIGS. 1A through 1C is to supply or input an arbitrarily ordered sequence of n items, each item having a numerical value, to a suitable data processing system on which the method is to be practiced (block 102 of FIG. 1A).
  • the next step is to initialize or set each of two variables m and k to the value one as represented by block 104.
  • the (k 1 )th entry of the (m 1 )th column of the difference table of the sequence of items is then calculated in accordance with block 106 of FIG. 1A and stored in a suitable difference bufier.
  • a determination is then made as to whether this value is positive or negative (block 108). A negative value would be obtained if the first item of the sequence were larger than the second item. If the difference is negative, the algorithm moves to block 110 otherwise the algorithm moves to block 112.
  • the current values of m and k are stored'in a suitable negative difference" buffer.
  • the two values are associated and as such are stored as a pair in the negative difference" bufier. (The purpose of designating the values as associated will become clear later.)
  • the value of the variable k is incremented by one. It is then determined whether the variable k is less than the value 11 corresponding to the number of entries in the sequence (block 114 of FIG. 18). If it is less, the algorithm returns to block 106 where a new entry in the difference table is calculated. At this stage of the description of the method, a new entry would be calculated and the process would be repeated until the variable k were incremented to a value equal to n at which time the algorithm would move from block 114 to block 116 of FIG.
  • the value of m which was initially set equal to one, is incremented by one.
  • a determination is then made as to whether m is less than n in accordance with block 118. Again, at this stage of the description of the method, m would be less than n and the algorithm would return to block 106 of FIG. 1A and further entries in the difference table would be calculated. After all entries of the difference table are calculated, at which time it would be determined that m is not less than n (block 118), the algorithm moves to block 120 of FIG. 1B.
  • the algorithm would then move to block 122 where the sequence of items would be printed out or otherwise made available to the user. At this stage of the description, of course, no sorting would have been done since the sequence as supplied to the data processing system would have been properly ordered.
  • the algorithm moves to block 124. There, the variable m is initialized to the highest value of m stored in the negative difference buffer. In the next step,
  • variable k is initialized to the highest value of k associated with the highest value of m selected in the previous step.
  • the value m k is then calculated (block 128 of FIG. 1C) and a determination is made as to whether the (m k)th entry of the sequence of n items is less than the kth entry (block 130). If it is less, the (m k)th entry and the kth entry are interchanged (block 132). If it is not less, the algorithm moves directly to block 134 of FIG. 1C.
  • the values of m and k of the negative difference buffer corresponding to the current values of the variables m and k are removed from the negative difference buffer. It is then determined whether or not the negative difference buffer is empty (block 136). If it is not empty, the algorithm returns to block 124 of FIG. 1B and the process of comparing the values of two more entries in the sequence is carried out. If the negative difference buffer is empty, indicating that all entries of the sequence which were designated by the items stored in the negative difference buffer (and now removed) have been examined, the algorithm returns to block 104 of FIG. 1A.
  • a new difference table is then generated in accordance with the description above and if the difference table contains no negative differences, the process is terminated in accordance with block 120 and 122 of FIG. 18 indicating that the sequence is now arranged in order of ascending magnitude. If the new difference table contains negative differences, then step 124 of FIG. 1A is commenced in accordance with the previous description.
  • the first steps in processing the sequence of numbers of FIG. 2A in accordance with the method of the present invention would be to generate the difference table shown in FIG. 2B.
  • the first entry of the first column of the difference table is obtained by subtracting nine from five, the second entry is obtained by subtracting five from three, etc.
  • Steps 102 through 118 of FIGS. 1A and 1B would be the steps followed by a data processing system to generate the difference table of FIG. 2B.
  • each entry of the difference table is generated, it is determined whether that entry is negative or positive (see step 108 of FIG. 1A). If the entry is negative, the values of m and k for that entry are stored in a negative difference buffer (step 110 of FIG. 1A).
  • the negative entries of the difference table of FIG. 2B are indicated in FIG. 2C.
  • six pairs of values would be stored in the negative difference buffer of the data processing system. Each of these values would identify the column number and row number (in the difference table) of a negative difference.
  • the process would move from block 120 of FIG. IE to block 124.
  • a variable m would be initialized to the highest value of m stored in the negative difference buffer.
  • the highest value of m so stored, as indicated in FIG. 2C, would be four.
  • a variable k would be initialized to the highest value of k associated with m 4 in the negative difference buffer. In the present example, there is only one value of k associated with m 4 and that value is one.
  • the next step of the process is to calculate m k 4 l 5 (block 128 of FIG. 1C).
  • the values of m and k (4 and 1) would be removed from the negative difference buffer (block 134 of FIG. 1C) and the negative difference buffer would be examined to determine if it were empty (block 136). In the present example, the negative difference buffer would not be empty, so the process would return to block 124 of FIG. 1B and new values of m and k would be chosen from the negative difference buffer.
  • a summary of the steps taken in processing the sequence of FIG. 2A is shown in the table of FIG. 2D.
  • the top row of the table indicates the negative differences of the difference table generated for the sequence.
  • the second row of the table simply identifies the entries in the sequence which are to be compared for each m and k in the negative difference buffer.
  • the third row indicates what action, if any, is to be taken on the sequence as a result of comparing the entries of the sequence.
  • the last row of the table indicates the status of the sequence following the examination of different pairs of entries of the sequence.
  • the original order of the sequence, as given in FIG. 2A is shown in the second column and last row of the table.
  • the status of the sequence is as shown in the third column and last row of the table.
  • the next value of m and k from the negative difference buffer to be examined is three and two respectively.
  • the entries to be examined are (m k)th or fifth entry and the kth or second entry.
  • the fifth entry now is nine and the second entry is five. Since nine is not less than five, no interchange of the entries is made.
  • Processing the exemplary sequence of FIG. 2A would conclude with the generation of a new negative difference table and a determination that the table contains no negative differences (block of FIG. 1B). The sequence of items would then be made available for output to the user.
  • the method of the present invention may also be utilized to arrange a sequence of items in order of descending magnitude. In this case, however, positive differences in the difference table are utilized to determine which entries in the sequence are to be examined. Further, an interchange is made if the (m k)th entry is greater (rather than less) than the kth entry.
  • FIGS. 3A and 3B show an exemplary programming implementation of the present invention.
  • the program is written in the soalled GMAP language described& for examples; in the General Electric 625/635 Programming Reference Manual, CPB l004F, for implementation on any General Electric 600 Series computer. Implementation of the present invention in the program of FIGS. 3A and 3B is apparent from an examination thereof and is therefore not described further.
  • a method of sorting a sequence of information items comprising the steps of a. applying to said data processing system a sequence of information items, each of said items having a numerical value,
  • a method as in claim 1 further comprising the steps of e. generating a new difference table for the sequence obtained at the conclusion of step (d),
  • a machine process for arranging a sequence of numerically valued information items in order of ascending magnitude comprising the steps of a. generating a difference table for said sequence of items,
  • storing in a storage means the column number and associated row number of each negative entry of the most recently generated difference table
  • a process as in claim 3 further comprising the step of repeating steps (b) through (h) until a difference table is generated which contains no negative differences.
  • a process of sorting a sequence of information items in order of descending magnitude comprising the steps of a. applying to said data processing system a sequence of information items, each of said items having a numerical value,
  • a method an in claim 5 further comprising the steps of e. generating a new difference table for the sequence obtained at the conclusion of step (d),

Abstract

A sequence of information items, each of which has or can be assigned a numerical value, is sorted to obtain a list arranged in order of ascending or descending magnitude. This is accomplished by generating a difference table for the sequence and then interchanging various items of the sequence depending on the entries of the difference table.

Description

United States Patent 1151 3,662,402 Bond et al. p 1 May 9, 1972 541 DATA SORT METHOD UTILIZING 2,901,732 8/1959 Canning ..340/174 F INITE DIFFERENCE TABLES OTHER PUBLICATIONS [72] Inventors: Kenneth L. Bond; James A. Schooley, both of Phoenix Ariz Number Sorting by Computer, I. A. ltskovlch et al., Cybernetics, v01. 1, pp. 93- 95, Sept.- Oct. 1965. Asslgneel Honeywdl Information Systems An Introduction to Sort Techniques," E. Opengart, Compu- Waltham, Massters and Automation, v61. 16, p. 24- 29, Feb. 1967. [22] Filed, 4 1970 Replacement Selection Sorting Techniques," M. A. Goetz, Spring .Iomt Computer Conference, pp. 599- 607, Spring, [21] Appl. No.: 95,205 1964.
52 US. (:1 ..444/1 f f' 51 1 1m. (:1. ..G06f 7/24, G06f 7/04 45mm Rlmds 5s 1 Field 6: Search ..340/172.5; 235/616 Mower-Fred lamb and Edward Hughes [56] References Cited 1 ABSTRACT UNITED STATES PATENTS A sequence of information items, each of which has or can be asslgned a numencal value, 15 sorted to obtain a 11st arranged 1 1 Armstrong in order of ascending or descending magnituda is accom. 3,444,523 5/1969 Dil'ks 34O/l72 5 plished by generating a difference table for the sequence and 3,428,946 2/1969 Batchel" 340/146 2 then interchanging various items of the sequence depending 3,380,029 4/1968 Goetz 340/172 5 on the entries f the difi table. 331L892 3/1967 OConnor et al. ..340/172.5 2,987,705 6/1961 Van Mechelen ..340/172.5 6 Claims, 10 Drawing Figures 1 Z neacisszo A; A; A? A2 12 1 (mfk, k) 1 9 1 r INTEELl/flA/G'E INTEEfl-MNGE 46'7/0N 7'0 I/IED N0 85 TAM 5N av Z'f, A/OA/E AIDA/E ,w/vs j NONE SEQU ENIE/EQ ENTE/ES 25.904 7' lA/' MIG/AWL $74705 0F SEQUENCE $'EQUENCE z/vwr SEQUENCE OF 3; ITEMS [Mr/44 ME E AND 5 70 ONE cm cuz ,4 re A Z fl/VD "STU/PE IN D/F'FEEENCE BUFFER IA/CkMEA/fg BYOA/' INVENTOR.
JAMES '4. S'C'HOOLEY" l KENNETH A. BOA/D ATTORNEY I I I I I I I v I I I v v I I PATENTEDMAY 91972 3,662,402
A SHEET 8 OF 8 THIS DOCUMENT DESCRIBES THE DIFFERENCE SORT PROCESS AS USED ON THE GE 625/635 SERIES COMPUTER, THE PROCESS IN THIS CASE IS CODED IN THE GMAP ASSEMBLY LANGUAGE FOR THE GE 625/635 COMPUTER,
EXECUTION OF THE CODE FROM "BDIF" THRU "BDOO" WILL BUILD A FINITE DIFFERENCE TABLE FROM INITIAL ENTRIES (SORT KEYS),
10 IF A NEGATIVE DIFFERENCE Is DETECTED, CODE AT "BDO3" wILL ll STORE THE Row AND COLUMN LOCATION FOR THIS DIFFERENCE IN 12 THE NEGATIVE DIFFERENCE BUFFER ("NEGBUF") -1= 1 3 A A A A A I A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A 1' A A A A A A 'c l4 BDIF NULL 15 STX7 BDOO 16 LXL7 N 17 CMPX7 2 ,DU
18 TNC C 19 sx 7 Q 20 SBX7 2 ,DU
21 SXL7 s 22 STZ M 23 A STZ L zER DIF COL COUNTER 24 LDQ N 25 MPY 2 ,DL
26 SBQ I,DL
27 STQ R 28 STZ K ZERO ENT COUNT 29 A08 M BUMP DIF COL COUNTER 30 LDA M 31 CMPA N IS M= N 32 TRC BDOO YEs, RET
33 BDOS LDA M M=DIF COUNT 34 CMPA I,DL
35 TZE BDO9 36 ADA K AR=ROw+DIF CNT 37 CMPA Q 38 TRC BDO1 YES IF TRA 39 BDIO LDA M 40 CMPA ,DL 15 THIS FIRST DIF 41 TZE BDOZ SET DELTA=2 43 EAx7 0,3 x7=LOw Row 44 EAX3 1,3 X3=HIGH Row 45 EAXO 0 SET DELTA =1 46 BDO4 XED DIFF,0
47 LXLA L 49 LDQ NEGBUF 50 ANQ -1,DL
51 CMPQ s 52 TRC BDOO ONLY STORE N-l ENTRIES IN NEGBUF I v I I PATENIEDHAY 9 I972 58 BDO9 62 BDO2 69 BDOl 79 BDO8 83 BDO7 85 BDO3 96 BDOO 97 DIFF 98 S'I'A ALS TMI
AOS TRA ADA CMPA TRC TRA EAXO Q MPY EAX3 EAX7 EAX3 TRA LDA ALS STCA LDXO STXO LDA ALS
STCA LDXO STXO LDA TTF STA TRA STA TRA LDA
AOS
ALS
ORA
LXLO ADXO STA AOS TRA LDA
RETURN TALE,O6 DIF TALE TALD, 10 BDO7 TALE,ID A
TALE, ID BDO8 NEGBUF NEGBUF 0,0 NEGBUF B005 4,DL SORT,1
SHEET 7 BF 8 ,lNl'I' IND 'IRA IF NEG SET DELTA =2 THIS CODE IS FOR DELTA =2 IF ON DIFF O X7=LOW ROW ADD 2 ,X3=HIGH ROW AR=DIFI ENTRIES MOVE NO. OF ENTRIES FOR TALLY STORE TALLY COUNT STORE ADD AR=DIFI ENTRIES SAVE TALLY COUNT SAVE ADD NO RUNOUT IF TRA STORE LAST ENT IN DIF AU=DIF COUNT =M AL=ROW ENT COUNT K STORE M AND ENT COUNT IN NEGBUF RET X3=HIGH ROW X7=LOW ROW X3=HIGH ROW X7=LOW ROW BACKGROUND OF THE INVENTION This invention relates generally to data processing methods and particularly to a method for sorting a sequence of information items.
Sorting may be defined as the process of arranging a set of information items in a uniform sequence as determined by the magnitudes of the individual items. See Richards, R.K., Arithmetic Operations in Digital Computers, D. Van Nostrand Co., Inc., 1955, page 295. Sorting is one of the basic data processing functions and is used in a variety of applications. For example, sorting is used for maintenance of business files such as inventory records and payroll records, for study and analysis of statistical data, for visual computer output such as printouts or CRT displays, and for maintenance of a data processing systems own internal data file.
1 It is desirable that any sorting method which is to be used in a data processing system be simple and efficient, i.e., that the method include few instructions or steps so that very little system memory is required to store the program implementation of the method and that the running time of the program implementation on the data processing system be as short as possible.
SUMMARY OF THE INVENTION It is an object of the present invention to provide a data sorting method which includes few instructions or steps.
It is another object of the present invention to provide a data sorting method which, when perfonned on a data processing system, operates to sort a sequence of information items in a relatively short period of time.
These" and other objects of the present invention are realized in a specific illustrative algorithm in which a difference table is generated for an arbitrarily ordered sequence of numerically valued items. Each negative entry of the difference table is noted by storing the entrys column number m and row number k. If, for each m and k stored, the (m k)th entry of the sequence of items has a magnitude less than that of the kth entry, then the two entries are interchanged. After all possible interchanges have been made, adifference table is generated for the new sequence. If no negative differences are found in this difference table, the process is terminated, otherwise the process is reiterated until a difference table with no negative differences isobtained. At the termination of the process, the sequence of n items will be arranged in order of ascending magnitude. I i a To obtain a sequence arranged in order of descending magnitude, positive differences of the difference tables are utilized rather than negative differences.
BRIEF DESCRIPTION OF THE DRAWINGS A complete understanding of the present invention and of the above and other advantages thereof may be gained from a consideration of the following detailed description of an illustrative embodiment thereof presented hereinbelow in connection with the accompanying drawings in which:
FIG. 1A, 1B, and 1C, with FIG. 1A positioned above FIG. 1B and FIG. 1B positioned above FIG. 1C, show a flow diagram representing a specific illustrative machine algorithm for practicing data processing in accordance with the present invention;
FIG. 2A shows an arbitrary sequence of n numbers which are to be sorted;
FIG. 2B shows the difference table generated for the sequence of numbers of FIG. 2A;
FIG. 2C shows which of the entries of the difference table of FIG. 2B are negative differences;
FIGS. 3A and 3B, and 3C show an illustrative computer program for implementing the algorithm represented in FIGS. 1A through 1C.
DETAILED DESCRIPTION The method of the present invention utilizes the so-called difference table," well-known in the field of mathematics. A difference table for a sequence of n numerically valued items is calculated by subtracting the first item in the sequence from the second, the second item in the sequence from the third, etc. until n-1 such differences are obtained. These differences comprise the first column of the difference table ordered in the order in which they were obtained, i.e., the difference between the first and second items of the sequence being the first entry in the column, the difference between the second and third items of the sequence being the second entry in the column, etc. Similarly, the differences between successive entries of this first column are then calculated to obtain the second column of the difference table. The process of obtaining the differences between entries of each column is continued until a final column containing but one entry is obtained. The entries of the difference table are generally represented by the symbol A where m designates the mth column of the difference table and k designates the kth entry of the column. Thus, A represents the kth entry of the mth column of a difference table. These conventions will be used in explaining the present invention.
The first step of the specific illustrative embodiment of the present invention shown in FIGS. 1A through 1C is to supply or input an arbitrarily ordered sequence of n items, each item having a numerical value, to a suitable data processing system on which the method is to be practiced (block 102 of FIG. 1A). The next step is to initialize or set each of two variables m and k to the value one as represented by block 104. The (k 1 )th entry of the (m 1 )th column of the difference table of the sequence of items is then calculated in accordance with block 106 of FIG. 1A and stored in a suitable difference bufier. A determination is then made as to whether this value is positive or negative (block 108). A negative value would be obtained if the first item of the sequence were larger than the second item. If the difference is negative, the algorithm moves to block 110 otherwise the algorithm moves to block 112.
In the step represented by block 110, the current values of m and k are stored'in a suitable negative difference" buffer. The two values are associated and as such are stored as a pair in the negative difference" bufier. (The purpose of designating the values as associated will become clear later.)
In the next step of the process, represented by block 112 of FIG. 1A, the value of the variable k is incremented by one. It is then determined whether the variable k is less than the value 11 corresponding to the number of entries in the sequence (block 114 of FIG. 18). If it is less, the algorithm returns to block 106 where a new entry in the difference table is calculated. At this stage of the description of the method, a new entry would be calculated and the process would be repeated until the variable k were incremented to a value equal to n at which time the algorithm would move from block 114 to block 116 of FIG.
In the step represented by block 116, the value of m, which was initially set equal to one, is incremented by one. A determination is then made as to whether m is less than n in accordance with block 118. Again, at this stage of the description of the method, m would be less than n and the algorithm would return to block 106 of FIG. 1A and further entries in the difference table would be calculated. After all entries of the difference table are calculated, at which time it would be determined that m is not less than n (block 118), the algorithm moves to block 120 of FIG. 1B.
In the step represented by block 120, a determination is made as to whether the negative difference buffer is empty. If it is empty, this means that there were no negative differences in the difi'erence table and that the sequence of n items is arranged in order of ascending magnitude as desired. The algorithm would then move to block 122 where the sequence of items would be printed out or otherwise made available to the user. At this stage of the description, of course, no sorting would have been done since the sequence as supplied to the data processing system would have been properly ordered.
If it is determined that the negative difference buffer is not empty, i.e., that the negative difference buffer contains stored pairs of values of m and k, then the algorithm moves to block 124. There, the variable m is initialized to the highest value of m stored in the negative difference buffer. In the next step,
represented by block 126, the variable k is initialized to the highest value of k associated with the highest value of m selected in the previous step. The value m k is then calculated (block 128 of FIG. 1C) and a determination is made as to whether the (m k)th entry of the sequence of n items is less than the kth entry (block 130). If it is less, the (m k)th entry and the kth entry are interchanged (block 132). If it is not less, the algorithm moves directly to block 134 of FIG. 1C.
In the step represented by block 134, the values of m and k of the negative difference buffer corresponding to the current values of the variables m and k are removed from the negative difference buffer. It is then determined whether or not the negative difference buffer is empty (block 136). If it is not empty, the algorithm returns to block 124 of FIG. 1B and the process of comparing the values of two more entries in the sequence is carried out. If the negative difference buffer is empty, indicating that all entries of the sequence which were designated by the items stored in the negative difference buffer (and now removed) have been examined, the algorithm returns to block 104 of FIG. 1A.
A new difference table is then generated in accordance with the description above and if the difference table contains no negative differences, the process is terminated in accordance with block 120 and 122 of FIG. 18 indicating that the sequence is now arranged in order of ascending magnitude. If the new difference table contains negative differences, then step 124 of FIG. 1A is commenced in accordance with the previous description.
The process of generating difference tables and comparing pairs of entries of the sequence is reiterated until a difference table which contains no negative differences is ultimately generated.
An example of the application of the method of the present invention to an arbitrarily ordered sequence of numbers will now be given. Consider the sequence of five numbers shown in FIG. 2A. As shown there, the first entry of the sequence is nine, the second is five, etc.
The first steps in processing the sequence of numbers of FIG. 2A in accordance with the method of the present invention would be to generate the difference table shown in FIG. 2B. The first entry of the first column of the difference table is obtained by subtracting nine from five, the second entry is obtained by subtracting five from three, etc. Steps 102 through 118 of FIGS. 1A and 1B would be the steps followed by a data processing system to generate the difference table of FIG. 2B.
As each entry of the difference table is generated, it is determined whether that entry is negative or positive (see step 108 of FIG. 1A). If the entry is negative, the values of m and k for that entry are stored in a negative difference buffer (step 110 of FIG. 1A). The negative entries of the difference table of FIG. 2B are indicated in FIG. 2C. Thus, in the course of processing the sequence of FIG. 2A, six pairs of values would be stored in the negative difference buffer of the data processing system. Each of these values would identify the column number and row number (in the difference table) of a negative difference.
Since the negative difference buffer would contain negative differences as a result of the difference table generated for the sequence of FIG. 2A, the process would move from block 120 of FIG. IE to block 124. There, a variable m would be initialized to the highest value of m stored in the negative difference buffer. The highest value of m so stored, as indicated in FIG. 2C, would be four. In the next step of the process, block 126, a variable k would be initialized to the highest value of k associated with m 4 in the negative difference buffer. In the present example, there is only one value of k associated with m 4 and that value is one. The next step of the process is to calculate m k 4 l 5 (block 128 of FIG. 1C). It is then determined whether the (m k 5)th entry of the sequence of FIG. 2A is less than the (k= l)th entry, in accordance with block 130 of FIG. 1C. Since the fifth entry of the sequence is two and the first entry is nine, the process would determine that the fifth entry is less than the first entry and the algorithm would move to block 132 of FIG. 1C. In accordance with block 132, the fifth entry of the sequence would be interchanged with the first entry.
In the next step of the process the values of m and k (4 and 1) would be removed from the negative difference buffer (block 134 of FIG. 1C) and the negative difference buffer would be examined to determine if it were empty (block 136). In the present example, the negative difference buffer would not be empty, so the process would return to block 124 of FIG. 1B and new values of m and k would be chosen from the negative difference buffer.
A summary of the steps taken in processing the sequence of FIG. 2A is shown in the table of FIG. 2D. The top row of the table indicates the negative differences of the difference table generated for the sequence. The second row of the table simply identifies the entries in the sequence which are to be compared for each m and k in the negative difference buffer. The third row indicates what action, if any, is to be taken on the sequence as a result of comparing the entries of the sequence. The last row of the table indicates the status of the sequence following the examination of different pairs of entries of the sequence. The original order of the sequence, as given in FIG. 2A, is shown in the second column and last row of the table.
Following the interchange of the fifth and first entries, as discussed above, the status of the sequence is as shown in the third column and last row of the table. As also shown in the table, the next value of m and k from the negative difference buffer to be examined is three and two respectively. Thus the entries to be examined are (m k)th or fifth entry and the kth or second entry. The fifth entry now is nine and the second entry is five. Since nine is not less than five, no interchange of the entries is made.
Examination of the values stored in the negative difference buffer continues with no interchange of entries being made until the values ofm l and k 2 are examined. Then, as indicated in the seventh column of the table of FIG. 20, since the third entry of the sequence in the sixth column which is three is found to be less than the second entry which is five, the entries are interchanged to obtain the sequence shown in the seventh column. The only remaining values in the negative difference buffer to be examined are m l and k 1. As indicated by the last column of the table of FIG. 2D, no interchange of entries is called for as a result of such examination. The ordering thus obtained as a result of applying the process of the present invention to the sequence of FIG. 2A is as shown in the last column of the last row of the table in FIG. 2D. As there shown, the sequence is arranged in order of ascending magnitude.
Processing the exemplary sequence of FIG. 2A would conclude with the generation of a new negative difference table and a determination that the table contains no negative differences (block of FIG. 1B). The sequence of items would then be made available for output to the user.
The method of the present invention may also be utilized to arrange a sequence of items in order of descending magnitude. In this case, however, positive differences in the difference table are utilized to determine which entries in the sequence are to be examined. Further, an interchange is made if the (m k)th entry is greater (rather than less) than the kth entry.
FIGS. 3A and 3B show an exemplary programming implementation of the present invention. The program is written in the soalled GMAP language described& for examples; in the General Electric 625/635 Programming Reference Manual, CPB l004F, for implementation on any General Electric 600 Series computer. Implementation of the present invention in the program of FIGS. 3A and 3B is apparent from an examination thereof and is therefore not described further.
It is to be understood that the above described embodiment is only illustrative to the application of the principles of the present invention. Modifications in this embodiment may be devised by those skilled in the art without departing from the spirit and scope of the invention.
What is claimed is:
1. In a data processing system, a method of sorting a sequence of information items comprising the steps of a. applying to said data processing system a sequence of information items, each of said items having a numerical value,
b. generating a difference table for said sequence of items, the entries of said table being generally designated by A where m designates the mth column of said table and k designates the kth row of the column,
c. storing the values of m and k associated with each negative difference of the most recently generated difierence table,
d. interchanging, for each stored pair of values of m and k, the (m k)th and kth entries of said sequence if the (m k)th entry has a value less than that of the kth entry.
2. A method as in claim 1 further comprising the steps of e. generating a new difference table for the sequence obtained at the conclusion of step (d),
f. terminating said method if no negative difference is present in said new difference table, and
(g) repeating steps (c) through (f) if there isa negative difference present in said new difference table.
3. A machine process for arranging a sequence of numerically valued information items in order of ascending magnitude comprising the steps of a. generating a difference table for said sequence of items,
b. storing in a storage means the column number and associated row number of each negative entry of the most recently generated difference table,
c. setting a variable m equal to the value of the highest valued column number stored in said storage means,
d. setting a variable k equal to the value of the highest valued row number associated with said highest valued column number,
e. interchanging the (m k)th and the kth entries of said sequence if the (m k)th entry has a value less than that of the kth entry,
f. removing from said storage means the column number and associated row number corresponding to the variable m and k respectively,
g. repeating steps (c) through (f) if said storage means is not empty, and
h. generating a difference table for the sequence resulting from the performance of steps (a) through (g) if said storage means is empty.
4. A process as in claim 3 further comprising the step of repeating steps (b) through (h) until a difference table is generated which contains no negative differences.
5. In a data processing system, a process of sorting a sequence of information items in order of descending magnitude comprising the steps of a. applying to said data processing system a sequence of information items, each of said items having a numerical value,
b. generating a difference table for said sequence of items, the entries of said table being generally designated by A,,.'", where m designates the mth column of said table and k designates the kth row of the column, c. storing the values of mand k associated with each positive difference of the most recently generated difference table,
d. interchanging, for each stored pair of values of m and k, the (m k)th and kth entries of said sequence if the (m k)th entry has a value greater than that of the kth entry.
6. A method an in claim 5 further comprising the steps of e. generating a new difference table for the sequence obtained at the conclusion of step (d),
f. terminating said method if no positive difference is present in said new difference table, and
g. repeating steps (0) through (f) if there is a positive difference present in said new difference table.

Claims (6)

1. In a data processing system, a method of sorting a sequence of information items comprising the steps of a. applying to said data processing system a sequence of information items, each of said items having a numerical value, b. generating a difference table for said sequence of items, the entries of said table being generally designated by Delta km, where m designates the mth column of said table and k designates the kth row of the column, c. storing the Values of m and k associated with each negative difference of the most recently generated difference table, d. interchanging, for each stored pair of values of m and k, the (m + k)th and kth entries of said sequence if the (m + k)th entry has a value less than that of the kth entry.
2. A method as in claim 1 further comprising the steps of e. generating a new difference table for the sequence obtained at the conclusion of step (d), f. terminating said method if no negative difference is present in said new difference table, and (g) repeating steps (c) through (f) if there is a negative difference present in said new difference table.
3. A machine process for arranging a sequence of numerically valued information items in order of ascending magnitude comprising the steps of a. generating a difference table for said sequence of items, b. storing in a storage means the column number and associated row number of each negative entry of the most recently generated difference table, c. setting a variable m equal to the value of the highest valued column number stored in said storage means, d. setting a variable k equal to the value of the highest valued row number associated with said highest valued column number, e. interchanging the (m + k)th and the kth entries of said sequence if the (m + k)th entry has a value less than that of the kth entry, f. removing from said storage means the column number and associated row number corresponding to the variable m and k respectively, g. repeating steps (c) through (f) if said storage means is not empty, and h. generating a difference table for the sequence resulting from the performance of steps (a) through (g) if said storage means is empty.
4. A process as in claim 3 further comprising the step of repeating steps (b) through (h) until a difference table is generated which contains no negative differences.
5. In a data processing system, a process of sorting a sequence of information items in order of descending magnitude comprising the steps of a. applying to said data processing system a sequence of information items, each of said items having a numerical value, b. generating a difference table for said sequence of items, the entries of said table being generally designated by Delta km, where m designates the mth column of said table and k designates the kth row of the column, c. storing the values of m and k associated with each positive difference of the most recently generated difference table, d. interchanging, for each stored pair of values of m and k, the (m + k)th and kth entries of said sequence if the (m + k)th entry has a value greater than that of the kth entry.
6. A method an in claim 5 further comprising the steps of e. generating a new difference table for the sequence obtained at the conclusion of step (d), f. terminating said method if no positive difference is present in said new difference table, and g. repeating steps (c) through (f) if there is a positive difference present in said new difference table.
US95205A 1970-12-04 1970-12-04 Data sort method utilizing finite difference tables Expired - Lifetime US3662402A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US9520570A 1970-12-04 1970-12-04

Publications (1)

Publication Number Publication Date
US3662402A true US3662402A (en) 1972-05-09

Family

ID=22250638

Family Applications (1)

Application Number Title Priority Date Filing Date
US95205A Expired - Lifetime US3662402A (en) 1970-12-04 1970-12-04 Data sort method utilizing finite difference tables

Country Status (1)

Country Link
US (1) US3662402A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4575798A (en) * 1983-06-03 1986-03-11 International Business Machines Corporation External sorting using key value distribution and range formation
US4862356A (en) * 1986-01-09 1989-08-29 U.S. Philips Corporation Method and device for sorting objects provided with a parameter, according to the value of this parameter
US5190598A (en) * 1990-02-26 1993-03-02 Westinghouse Electric Corp. Steam turbine components having duplex coatings for improved erosion resistance
US5369762A (en) * 1990-06-28 1994-11-29 Wolf; William M. Method for sorting data in a computer at high speed by using data word values for address locations

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US2901732A (en) * 1954-06-28 1959-08-25 Univ California Electronic sorter
US2987705A (en) * 1950-09-29 1961-06-06 Int Standard Electric Corp Electrical sorting system
US3311892A (en) * 1963-09-30 1967-03-28 Gen Precision Inc Sorting system with two-line sorting switch
US3380029A (en) * 1965-04-09 1968-04-23 Applied Data Res Inc Sorting system
US3428946A (en) * 1965-08-26 1969-02-18 Goodyear Aerospace Corp Means for merging data
US3444523A (en) * 1959-02-02 1969-05-13 Gerhard Dirks Apparatus for sorting of recorded digital data
US3587057A (en) * 1969-06-04 1971-06-22 Philip N Armstrong Data sorting system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US2987705A (en) * 1950-09-29 1961-06-06 Int Standard Electric Corp Electrical sorting system
US2901732A (en) * 1954-06-28 1959-08-25 Univ California Electronic sorter
US3444523A (en) * 1959-02-02 1969-05-13 Gerhard Dirks Apparatus for sorting of recorded digital data
US3311892A (en) * 1963-09-30 1967-03-28 Gen Precision Inc Sorting system with two-line sorting switch
US3380029A (en) * 1965-04-09 1968-04-23 Applied Data Res Inc Sorting system
US3428946A (en) * 1965-08-26 1969-02-18 Goodyear Aerospace Corp Means for merging data
US3587057A (en) * 1969-06-04 1971-06-22 Philip N Armstrong Data sorting system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
An Introduction to Sort Techniques, E. Opengart, Computers and Automation, Vol. 16, p. 24 29, Feb. 1967. *
Number Sorting by Computer, I. A. Itskovich et al., Cybernetics, Vol. 1, pp. 93 95, Sept. Oct. 1965. *
Replacement Selection Sorting Techniques, M. A. Goetz, Spring Joint Computer Conference, pp. 599 607, Spring, 1964. *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4575798A (en) * 1983-06-03 1986-03-11 International Business Machines Corporation External sorting using key value distribution and range formation
US4862356A (en) * 1986-01-09 1989-08-29 U.S. Philips Corporation Method and device for sorting objects provided with a parameter, according to the value of this parameter
US5190598A (en) * 1990-02-26 1993-03-02 Westinghouse Electric Corp. Steam turbine components having duplex coatings for improved erosion resistance
US5369762A (en) * 1990-06-28 1994-11-29 Wolf; William M. Method for sorting data in a computer at high speed by using data word values for address locations

Similar Documents

Publication Publication Date Title
JP4848317B2 (en) Database indexing system, method and program
US4514826A (en) Relational algebra engine
US7801903B2 (en) Shared-memory multiprocessor system and method for processing information
McKay Asymptotics for 0-1 matrices with prescribed line sums
US3662402A (en) Data sort method utilizing finite difference tables
JPH09245043A (en) Information retrieval device
CN113448537B (en) Method for minimum-maximum calculation in associative memory
JPS6142031A (en) Sorting processor
EP4095719A1 (en) Sparse matrix multiplication in hardware
CN110221778A (en) Processing method, system, storage medium and the electronic equipment of hotel's data
EP3113038B1 (en) A data handling method
GB2378789A (en) Removal of duplicates from large data sets
Duszynski Visualizing and analyzing software variability with bar diagrams and occurrence matrices
Siegelnickel et al. Algorithm Analysis
JPH02294729A (en) Sort processing system
JP2811916B2 (en) Data file access method
CN114595416A (en) Data visualization method and device
JPH04101270A (en) N-dimensional data input system
JPH01226026A (en) Retrieving circuit
JPS60178573A (en) Data base processing system
JPH02259827A (en) Record editing system
JPH06274312A (en) General-purpose data conversion device
JPH0250220A (en) Summarized arithmetic processing machine
Aref PERFORMANCE BASED COMPARATIVE STUDY OF SORTTNG ALGORITHMS
JP2006031631A (en) Data base processing system and method, and program for data base processing