JP2011048801A - Bit stream data sorting device, method, and program - Google Patents

Bit stream data sorting device, method, and program Download PDF

Info

Publication number
JP2011048801A
JP2011048801A JP2009199115A JP2009199115A JP2011048801A JP 2011048801 A JP2011048801 A JP 2011048801A JP 2009199115 A JP2009199115 A JP 2009199115A JP 2009199115 A JP2009199115 A JP 2009199115A JP 2011048801 A JP2011048801 A JP 2011048801A
Authority
JP
Japan
Prior art keywords
key
bit position
keys
difference bit
difference
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.)
Granted
Application number
JP2009199115A
Other languages
Japanese (ja)
Other versions
JP2011048801A5 (en
JP5165654B2 (en
Inventor
Toshio Shinjo
敏男 新庄
Mitsuhiro Kokubu
光裕 國分
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.)
S Grants Co Ltd
Original Assignee
S Grants Co Ltd
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 S Grants Co Ltd filed Critical S Grants Co Ltd
Priority to JP2009199115A priority Critical patent/JP5165654B2/en
Priority to PCT/JP2010/004599 priority patent/WO2011024376A1/en
Publication of JP2011048801A publication Critical patent/JP2011048801A/en
Priority to US13/067,722 priority patent/US8515976B2/en
Publication of JP2011048801A5 publication Critical patent/JP2011048801A5/ja
Application granted granted Critical
Publication of JP5165654B2 publication Critical patent/JP5165654B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an efficient sorting method which does not cause invalid processing in sort processing of bit string data. <P>SOLUTION: A key that is a first reference is selected from keys to be sorted, and for each of a group of keys smaller than the selected key and a group of keys larger than the selected key, bit string comparison of the reference key with each of the keys to be sorted, the keys being composed of a bit string, is performed to determine a differential bit position that is a bit position where a different bit value is obtained first. The keys to be sorted are classified by the differential bit position, and the classification by the differential bit position with respect to a referential key among a plurality of keys classified into the same differential bit position is further repeated, whereby a sorted key sequence is obtained. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、ビット列データのソート装置、方法及びプログラムに関する。   The present invention relates to a bit string data sorting apparatus, method, and program.

近年、社会の情報化が進展し、大規模なデータベースが各所で利用されるようになってきている。このような大規模なデータベースからレコードを検索するには、各レコードの記憶されたアドレスと対応づけられたレコード内の項目をインデックスキーとして検索をし、所望のレコードを探し出すことが通例である。また、全文検索における文字列も、文書のインデックスキーと見なすことができる。   In recent years, with the progress of informatization of society, large-scale databases are being used in various places. In order to search for a record from such a large database, it is usual to search for an item in the record associated with the stored address of each record using an index key to find a desired record. A character string in full-text search can also be regarded as a document index key.

そして、それらのインデックスキーはビット列で表現されることから、データベースの検索はビット列の検索に帰着されるということができる。
一方、データベースに関連した処理として、データベース中のレコードのインデックスキーによるソート処理が行われている。このソート処理もビット列のソート処理に帰着される。なお、以下においては、ビット列データを、単にキーということもある。
Since these index keys are expressed by bit strings, it can be said that a database search is reduced to a bit string search.
On the other hand, as a process related to the database, a sort process based on an index key of records in the database is performed. This sort process is also reduced to a bit string sort process. In the following description, the bit string data may be simply referred to as a key.

ソートの手法は各種のものが開発されており、下記特許文献1には、クイックソート、ラディックソート(基数ソート)等が紹介されている。また、特許文献2にも基数ソートが記載されている。   Various sort methods have been developed, and the following Patent Document 1 introduces quick sort, radic sort (radix sort), and the like. Patent Document 2 also describes radix sort.

図1に示すのは、従来の基数ソートの概念を説明する図である。基数ソートによれば、図1に例示するソート対象である4ビットのビット列であるキーは、0ビット目から3ビット目に至る各ビット位置におけるビット値による分類を繰り返すことにより、ソートが実行される。以下、図1の例示により、基数ソートの概念を説明する。   FIG. 1 is a diagram for explaining the concept of a conventional radix sort. According to the radix sort, the key which is the 4-bit bit string to be sorted illustrated in FIG. 1 is sorted by repeating the classification by the bit value at each bit position from the 0th bit to the 3rd bit. The Hereinafter, the concept of the radix sort will be described with reference to FIG.

図1には、ソート対象であるキーからなるキー列100が示されている。図1の例示では、キー列100に含まれるキーの存在するキーの位置であるキー位置101が100a(以下、キー位置100aのように表記する。)である記憶領域にはキー“1010”が存在する。また、キー位置100b、100c、100d、100e、100f、100gには、それぞれキー“0111”、“1000”、“0010”、“0110”
、“1111”、“1011”が存在する。
FIG. 1 shows a key string 100 including keys to be sorted. In the example of FIG. 1, the key “1010” is stored in the storage area in which the key position 101 that is the position of the key included in the key string 100 is 100a (hereinafter referred to as the key position 100a). Exists. Further, the keys “0111”, “1000”, “0010”, “0110” are respectively provided in the key positions 100b, 100c, 100d, 100e, 100f, and 100g.
, “1111”, “1011” exist.

図1に示すように、まずビット位置毎の分類(0ビット目)110aによりキー列100に含まれるキーの0ビット目による分類が行われる。その結果、キー“0111”、キー“0010”及びキー“0110”からなる0ビット目の値0の組120aと、キー“1010”、キー“1000”、キー“1111”
及びキー“1011”からなる値1の組121aが得られる。次に値0の組120aはビット位置毎の分類(1ビット目)110bにより、次に値1の組121aはビット位置毎の分類(1ビット目)110eによりそれぞれ1ビット目の値による分類が行われる。
As shown in FIG. 1, first, classification by the 0th bit of the key included in the key string 100 is performed by the classification (0th bit) 110a for each bit position. As a result, a set 120a of the 0th bit value 0 consisting of the key "0111", the key "0010", and the key "0110", the key "1010", the key "1000", and the key "1111"
And a set 121a of value 1 consisting of the key “1011” is obtained. Next, the set 0a of the value 0 is classified by the value of the first bit by the classification (first bit) 110b for each bit position, and the set 121a of the value 1 is classified by the value of the first bit by the classification (first bit) 110e for each bit position. Done.

ビット位置毎の分類(1ビット目)110bでは、1ビット目の値0の組120bとして1つのキー“0010”が得られるので、ソート済みキー列130のキーを格納する位置であるキー位置131が130a(以下、キー位置130aのように表記する。)である記憶領域に格納される。また、1ビット目の値1の組121bとして、キー“0111”とキー“0110”の組が得られ、ビット位置毎の分類(2ビット目)110cの分類で、2ビット目の値に基づく分類が行われる。   In the classification (first bit) 110b for each bit position, one key “0010” is obtained as the set 120b of the first bit value 0, so the key position 131 that is a position for storing the key of the sorted key string 130. Is stored in the storage area 130a (hereinafter referred to as a key position 130a). Further, a set of the key “0111” and the key “0110” is obtained as the value 1 set 121b of the first bit, and the classification (second bit) 110c for each bit position is based on the value of the second bit. Classification is performed.

2ビット目の分類110cでは、キー“0111”とキー“0110”の2ビット目が共に1であることから、2ビット目の値1の組121cしか得られず、1ビット目の値1の組121bと同じキーが3ビット目による分類の対象となり、ビット位置毎の分類(3ビット目)110dにより3ビット目による分類が行われる。ビット位置毎の分類(3ビット目)110dでは、3ビット目の値0の組120dとして1つのキー“0110”が得られるので、キー位置130bに格納される。同様に、3ビット目の値1の組121dとして1つのキー“0111”が得られるので、ソート済みキー列130の次の値のキーを格納するキー位置130cに格納される。なお、ソート済みキー列には、キー位置の符号順に小さいほうのキーから格納されるものとする。 In the second bit classification 110c, since the second bits of the key “0111” and the key “0110” are both 1, only the first bit value set 121c is obtained, and the first bit value 1 The same key as the set 121b is the target of classification by the third bit, and classification by the third bit is performed by the classification (third bit) 110d for each bit position. In the classification (third bit) 110d for each bit position, one key “0110” is obtained as the set 120d of the third bit value 0, and is stored in the key position 130b. Similarly, since one key “0111” is obtained as the set 121d of the value 1 of the third bit, it is stored in the key position 130c for storing the key of the next value in the sorted key string 130. Note that the sorted key string is stored from the smaller key in the code order of the key position.

一方、ビット位置毎の分類(1ビット目)110eでは、1ビット目の値0の組120eとして、キー“1010”、キー“1000”
、キー“1011”の組が得られ、ビット位置毎の分類(2ビット目)110fの分類で、2ビット目の値に基づく分類が行われる。また、1ビット目の値1の組121eとして、1つのキー“1111”が得られるので、ソート済みキー列130のキー位置130gに格納される。
On the other hand, in the classification for each bit position (first bit) 110e, the key “1010” and the key “1000” are set as the set 120e of the first bit value 0.
, A set of keys “1011” is obtained, and classification based on the value of the second bit is performed in the classification of each bit position (second bit) 110f. In addition, since one key “1111” is obtained as a set 121e of the value 1 of the first bit, it is stored in the key position 130g of the sorted key string 130.

ビット位置毎の分類(2ビット目)110fでは、2ビット目の値0の組120fとして、1つのキー“1000”が得られるので、ソート済みキー列130のキー位置130dに格納される。また、2ビット目の値1の組121fとして、キー“1010”、キー“1011”の組が得られ、ビット位置毎の分類(3ビット目)110gの分類で、3ビット目の値に基づく分類が行われる。   In the classification (second bit) 110f for each bit position, one key “1000” is obtained as a set 120f of the second bit value 0, and is stored in the key position 130d of the sorted key string 130. Further, a set of the key “1010” and the key “1011” is obtained as the set 121f of the value 1 of the second bit, and is based on the value of the third bit in the classification of each bit position (third bit) 110g. Classification is performed.

ビット位置毎の分類(3ビット目)110gでは、3ビット目の値0の組120gとして1つのキー“1010”が得られるので、ソート済みキー列130のキー位置130eに格納される。同様に、3ビット目の値1の組121gとして1つのキー“1011”が得られるので、ソート済みキー列130の次の格納位置であるキー位置130fに格納される。 In the classification (third bit) 110g for each bit position, one key “1010” is obtained as a set 120g of the value 0 of the third bit, and is stored in the key position 130e of the sorted key string 130. Similarly, since one key “1011” is obtained as the set 121g of the value 1 of the third bit, it is stored in the key position 130f that is the next storage position of the sorted key string 130.

以上の処理により、キー列100のキーは、ソート済みキー列130のキー位置130a〜130gにソートされて格納される。しかし、上述の基数ソート方法によりソートを実行する場合には、図1に示すビット位置毎の分類(2ビット目)110cにみられるように、分類が行われない無効な処理が発生する。   Through the above processing, the keys of the key string 100 are sorted and stored in the key positions 130a to 130g of the sorted key string 130. However, when sorting is performed by the above-described radix sort method, invalid processing in which classification is not performed occurs as seen in the classification (second bit) 110c for each bit position shown in FIG.

特開2002−116907号公報JP 2002-116907 A 特開2005−316663号公報JP 2005-316663 A

そこで本発明の解決しようとする課題は、ビット列データのソート処理において、無効となる処理が発生しない、効率的なソート手法を提供することである。 Therefore, the problem to be solved by the present invention is to provide an efficient sorting method in which invalid processing does not occur in the sort processing of bit string data.

本発明のソート処理によれば、ソート対象のビット列からなるキーであるソート対象キーから任意の基準となるキーを基準キーとして選択し、基準キーとソート対象キーの大小比較を行い、ソート対象キーの基準キーより大きいキーと基準キーより小さいキーのそれぞれのグループ毎に、基準キーとソート対象キーのビット列比較を行い、最初に異なるビット値となるビット位置である差分ビット位置を求め、差分ビット位置によるソート対象キーの分類を行い、同一の差分ビット位置に分類された複数のキーのうちの基準となるキーについての差分ビット位置による分類をさらに繰り返すことにより、ソート済みキー列を取得する。   According to the sorting process of the present invention, an arbitrary reference key is selected as a reference key from the sort target key that is a key consisting of a bit string to be sorted, the size of the reference key and the sort target key is compared, and the sort target key For each group of keys larger than the reference key and keys smaller than the reference key, the bit string comparison of the reference key and the sort target key is performed, and a difference bit position that is a bit position that first becomes a different bit value is obtained. The sort target keys are classified according to the position, and the sorted key string is obtained by further repeating the classification based on the difference bit position for the reference key among the plurality of keys classified into the same difference bit position.

本発明によれば、差分ビット位置によりキーのソートを行うため、分類が行われない無効な処理は発生しない。したがって、効率的なソート処理を実現することができる。   According to the present invention, since the keys are sorted by the difference bit position, invalid processing that does not perform classification does not occur. Therefore, efficient sort processing can be realized.

従来の基数ソートの概念を説明する図である。It is a figure explaining the concept of the conventional radix sort. 本発明の一実施の形態における差分ビット位置によるソート処理の概念を説明する図である。It is a figure explaining the concept of the sort process by the difference bit position in one embodiment of this invention. 本発明の一実施の形態における差分ビット位置によるソート処理で用いるデータ構造例を説明する図である。It is a figure explaining the example of a data structure used by the sort process by the difference bit position in one embodiment of this invention. 本発明の一実施の形態におけるビット列データソート装置の機能ブロック構成例を説明する図である。It is a figure explaining the functional block structural example of the bit string data sorting apparatus in one embodiment of this invention. 本発明を実施するためのハードウェア構成例を説明する図である。It is a figure explaining the hardware structural example for implementing this invention. 本発明の一実施の形態におけるソート処理全体の処理フロー例を説明する図である。It is a figure explaining the example of a processing flow of the whole sort process in one embodiment of this invention. 本発明の一実施の形態における基準キーより小さいソートキーのグループと大きいソートキーのグループについてそれぞれ差分ビット位置により分類する処理フロー例を説明する図である。It is a figure explaining the example of a processing flow which classify | categorizes according to a difference bit position about the group of the sort key smaller than the reference | standard key and the group of a big sort key in one embodiment of this invention. 本発明の一実施の形態における基準キーより大きいソートキーのグループを分類する処理の前段の処理フロー例を説明する図である。It is a figure explaining the example of a process flow of the front | former stage of the process which classifies the group of the sort key larger than the reference | standard key in one embodiment of this invention. 本発明の一実施の形態における基準キーより大きいソートキーのグループを分類する処理の後段の処理フロー例を説明する図である。It is a figure explaining the example of a processing flow of the latter part of processing which classifies a group of sort keys larger than a standard key in one embodiment of the present invention. 本発明の一実施の形態における基準キーより小さいソートキーのグループを分類する処理の前段の処理フロー例を説明する図である。It is a figure explaining the example of a process flow of the front | former stage of the process which classifies | sorts the group of the sort key smaller than the reference | standard key in one embodiment of this invention. 本発明の一実施の形態における基準キーより小さいソートキーのグループを分類する処理の後段の処理フロー例を説明する図である。It is a figure explaining the example of a processing flow of the latter part of processing which classifies a group of sort keys smaller than a standard key in one embodiment of the present invention. 本発明の一実施の形態における基準キーより小さいソートキーを差分ビット位置順に取り出す処理の処理フロー例を説明する図である。It is a figure explaining the example of a processing flow of the process which takes out the sort key smaller than the reference | standard key in order of difference bit position in one embodiment of this invention. 本発明の一実施の形態における差分ビット位置にリンクする複数のソートキーを差分ビット位置順に細分類する処理の処理フロー例を説明する図である。It is a figure explaining the example of a processing flow of the process which subdivides the some sort key linked with the difference bit position in one embodiment of this invention in order of a difference bit position. 本発明の一実施の形態における基準キーより大きいソートキーを差分ビット位置順に取り出す処理の処理フロー例を説明する図である。It is a figure explaining the example of a processing flow of the process which takes out the sort key larger than the reference | standard key in order of difference bit position in one embodiment of this invention. 本発明の一実施の形態における差分ビット位置にリンクする複数のソートキーを差分ビット位置順に細分類する処理の処理フロー例を説明する図である。It is a figure explaining the example of a processing flow of the process which subdivides the some sort key linked with the difference bit position in one embodiment of this invention in order of a difference bit position. 本発明の一実施の形態におけるキーを降順に取り出すデータの流れを説明する図である。It is a figure explaining the flow of the data which takes out the key in descending order in one embodiment of this invention.

以下、本発明を実施するための形態を、図1に示すキー列100に含まれるキーと同一のキーをソート対象のキーとして例示して説明する。
本出願人は、特願2008−325692において、ソート対象キーの差分ビット位置に基づいた分類手法をすでに提案している。この提案済みの分類手法は、基準キーをソート対象キーの最小値あるいは最大値とするものである。
それに対して、以下で説明する本発明の実施の態様においては、基準キーとしてソート対象キーの中から任意のものを選択することができる。例えばソート対象キーの格納された記憶領域の先頭の位置に格納されたソート対象キーを基準キーとする。
Hereinafter, a mode for carrying out the present invention will be described by exemplifying the same key as the key included in the key column 100 shown in FIG. 1 as a sort target key.
In Japanese Patent Application No. 2008-325692, the present applicant has already proposed a classification method based on the difference bit position of the sort target key. This proposed classification method uses the reference key as the minimum value or the maximum value of the sort target keys.
On the other hand, in the embodiment of the present invention described below, an arbitrary one can be selected from the sort target keys as the reference key. For example, the sort target key stored at the top position of the storage area in which the sort target key is stored is used as the reference key.

図2Aに示すのは、本発明の一実施の形態における差分ビット位置によるソート処理の概念を説明する図である。ソート対象のキー列100及びソート済みキー列130は、図1に示すものと同じである。キー列100の先頭のキー100aに位置するキー“1010”が基準キー148aとして選択されている。
キー列100を構成する各キーは、差分ビット位置による分類149aにおいて、基準キー148a、基準キーより小さく、基準キー148aとの差分ビット位置が0であるキー群140a及び基準キーとの差分ビット位置が2であるキー群142a、基準キーより大きく、基準キー148aとの差分ビット位置が1であるキー群141a及び基準キーとの差分ビット位置が3であるキー群143aに分類される。
FIG. 2A is a diagram for explaining the concept of the sorting process based on the difference bit position according to the embodiment of the present invention. The sort target key string 100 and the sorted key string 130 are the same as those shown in FIG. The key “1010” located at the top key 100a of the key string 100 is selected as the reference key 148a.
Each key constituting the key sequence 100 is different from the reference key 148a and the reference key in the classification 149a based on the difference bit position, and the difference bit position from the reference key 148a and the key group 140a and the difference bit position from the reference key. 2 is classified into a key group 142a which is larger than the reference key, a key group 141a whose difference bit position is 1 from the reference key 148a, and a key group 143a whose difference bit position is 3 from the reference key.

図2Aの例では、基準キー148aは“1010”である。キー群140aにはキー“0111”、“0010”及び“0110”が含まれており、キー群142aには、キー“1000”のみが含まれている。また、キー群141aには、キー“1111”のみが含まれ、キー群143aには、キー“1011”のみが含まれている。 In the example of FIG. 2A, the reference key 148a is “1010”. The key group 140a includes keys “0111”, “0010”, and “0110”, and the key group 142a includes only the key “1000”. The key group 141a includes only the key “1111”, and the key group 143a includes only the key “1011”.

基準キー148aは、図の点線の矢印158aに示すように、ソート済みキー列130のキー位置130eに格納される。また、キー群142aのキーは1つのみであるので、図の点線の矢印152aに示すように、ソート済みキー列130のキー位置130dに格納される。同様に、キー群141aのキー及びキー群143aのキーはそれぞれ1つのみであるので、図の点線の矢印151a及び153aに示すように、ソート済みキー列130のキー位置130g及び130fにそれぞれ格納される。
なお、ソート済みキー列130へのキーの格納については、後に詳細に説明する。
The reference key 148a is stored in the key position 130e of the sorted key row 130 as indicated by the dotted arrow 158a in the figure. Further, since there is only one key in the key group 142a, the key group 142a is stored in the key position 130d of the sorted key string 130 as indicated by the dotted arrow 152a in the figure. Similarly, since there is only one key in the key group 141a and one key in the key group 143a, the keys are stored in the key positions 130g and 130f of the sorted key row 130, as indicated by the dotted arrows 151a and 153a in the figure. Is done.
The storage of keys in the sorted key string 130 will be described in detail later.

基準キー148aとの差分ビット位置が0であるキー群140aにはキーが複数含まれているので、図の点線の矢印の組150aに示すように、差分ビット位置による分類149bにおいて、キー群140a内の最大値キー148bと、最大値キー148bとの差分ビット位置が1であるキー群141b、及び最大値キー148bとの差分ビット位置が3であるキー群143bに細分類される。図の例では、最大値キー148bは“0111”である。キー群141bには、キー
“0010”のみが、キー群143bには、キー“0110”のみが含まれている。
Since the key group 140a whose difference bit position with respect to the reference key 148a is 0 includes a plurality of keys, the key group 140a in the classification 149b based on the difference bit position as shown by the dotted arrow set 150a in the figure. The key group 141b has a difference bit position of 1 between the maximum value key 148b and the maximum value key 148b, and the key group 143b has a difference bit position of 3 from the maximum value key 148b. In the illustrated example, the maximum value key 148b is “0111”. The key group 141b includes only the key “0010”, and the key group 143b includes only the key “0110”.

最大値キー148bは、図の点線の矢印158bに示すように、ソート済みキー列130のキー位置130cに格納される。最大値キー148bとの差分ビット位置が1であるキー群141bに含まれるキーは1つなので、図の点線の矢印151bに示すように、ソート済みキー列130のキー位置130aに格納される。また、最大値キー148bとの差分ビット位置が3であるキー群143bに含まれるキーも1つなので細分類は終了し、図の点線の矢印153bに示すように、ソート済みキー列130のキー位置130bに格納される。 The maximum value key 148b is stored in the key position 130c of the sorted key row 130 as indicated by the dotted arrow 158b in the figure. Since the key group 141b whose difference bit position with respect to the maximum value key 148b is 1 is one key, it is stored in the key position 130a of the sorted key string 130 as indicated by the dotted arrow 151b in the figure. Further, since there is one key included in the key group 143b whose difference bit position is 3 with respect to the maximum value key 148b, the fine classification is finished, and as shown by the dotted arrow 153b in the figure, the keys of the sorted key sequence 130 Stored at position 130b.

以上の処理により、キー列100のキーは、ソート済みキー列130のキー位置130a〜130gに昇順で格納され、ソート処理が完了する。そして、本実施の態様によるソート処理は、差分ビット位置に基づいて分類を繰り返すので、分類処理毎に必ずキーの分類が実行される。 With the above processing, the keys of the key string 100 are stored in ascending order at the key positions 130a to 130g of the sorted key string 130, and the sorting process is completed. Since the sorting process according to the present embodiment repeats the classification based on the difference bit position, the key classification is always executed for each classification process.

なお、ソート済みキー列130のキー位置130a〜130gは連続した記憶領域のアドレスである必要はない。キー位置130a〜130d、130e、130f〜130gがそれぞれ分離した3つの記憶領域のアドレスであってもよい。また、例えばキー位置130a〜130dが記憶領域のアドレスの大きいものから小さいものの方向に割り振られたものであってもよい。基準キーとそのキー位置130e、基準キーより小さいキーのキー位置130a〜130dとアドレスの方向、基準キーより大きいキーのキー位置130f〜130gとアドレスの方向が分かれば、キー表130からキーを昇順または降順に取り出すことは容易である。勿論、キー位置130a〜130gを連続した記憶領域のアドレスの順に割り付けることも可能である。 Note that the key positions 130a to 130g of the sorted key string 130 do not have to be continuous storage area addresses. The key positions 130a to 130d, 130e, and 130f to 130g may be addresses of three separate storage areas. Further, for example, the key positions 130a to 130d may be assigned in the direction from the largest address of the storage area to the smallest address. If the key positions 130e to 130d of the key that is smaller than the reference key and the direction of the address and the key positions 130f to 130g of the key that is larger than the reference key and the direction of the address are known, the keys are arranged in ascending order. Or it is easy to take out in descending order. Of course, it is also possible to assign the key positions 130a to 130g in the order of the addresses of the continuous storage areas.

次に、図2Aを参照してその概念を説明した本実施の形態における差分ビット位置によるソート処理を実現するためのデータ構造と機能ブロック構成について説明する。本実施の形態における差分ビット位置によるソート処理は、図2Aに例示した差分ビット位置による分類149a、149bの処理を実行する機能ブロックを、ソート対象のあらゆるキーの組み合わせに対して用意すれば実現可能であることは明らかである。しかしそれでは資源の無駄遣いであり、その実現手法は現実的でない。そこで本実施の形態においては、以下に説明する工夫を行っている。   Next, the data structure and functional block configuration for realizing the sort processing based on the difference bit position in the present embodiment whose concept has been described with reference to FIG. 2A will be described. The sort processing based on the difference bit positions in the present embodiment can be realized by preparing the function blocks for executing the processing of the classifications 149a and 149b based on the difference bit positions illustrated in FIG. 2A for all combinations of keys to be sorted. Obviously. However, this is a waste of resources, and the realization method is not realistic. Therefore, in the present embodiment, the following devices are devised.

図2Bは、本発明の一実施の形態における差分ビット位置によるソート処理で用いるデータ構造例を説明するものである。図2Bに示すように、キー表309、差分ビット位置表310a、差分ビット位置表310b、リンク表311、及び基準キーを設定する記憶領域である基準キー650aが用いられる。   FIG. 2B explains an example of a data structure used in the sort processing based on the difference bit position according to the embodiment of the present invention. As shown in FIG. 2B, a key table 309, a difference bit position table 310a, a difference bit position table 310b, a link table 311 and a reference key 650a which is a storage area for setting a reference key are used.

キー表309はソート要求があったときにソート対象キー602が読み込まれて設定されるものである。図2Bの例示では、ソート対象の7つのキー602は、図1及び図2Aに示すキー列100に含まれるものが読み込まれている。キー表309の読出位置601の先頭はP0であり、以下、P1、P2、P3、P4、P5、P6と続いている。読出位置P0に設定されたキーを基準キーとしているが、別の読出位置に設定されたキーを基準キーとすることも可能である。点線の矢印689dで示すように、基準キーは基準キー650aに設定される。   The key table 309 is set by reading the sort target key 602 when there is a sort request. In the example of FIG. 2B, as the seven keys 602 to be sorted, those included in the key string 100 shown in FIGS. 1 and 2A are read. The head of the reading position 601 in the key table 309 is P0, and is followed by P1, P2, P3, P4, P5, and P6. The key set at the reading position P0 is used as the reference key, but the key set at another reading position can be used as the reference key. As indicated by the dotted arrow 689d, the reference key is set to the reference key 650a.

差分ビット位置表310aは、基準キーより小であって基準キーに対する同一の差分ビット位置を有するキーのうち、図2Bの例では、最大のキーの読出位置601を親リンク612aとして差分ビット位置611a毎に格納する。図2Bの例示では、点線の矢印660aで示すように、基準キー“1010”との差分ビット位置が0であるキー“0111”、“0010”、“0110”のうち最大のキー“0111”の読出位置P1が差分ビット位置表310aの差分ビット位置611aが0である位置に格納されている。また、点線の矢印662aで示すように、基準キー“1010”との差分ビット位置が2であるキーはキー“1000”だけであるので、キー“1000”の読出位置P2が差分ビット位置表310aの差分ビット位置611aが2である位置に格納されている。   In the example of FIG. 2B, the difference bit position table 310a is smaller than the reference key and has the same difference bit position with respect to the reference key. In the example of FIG. 2B, the maximum bit read position 601 is the parent link 612a. Store every time. In the example of FIG. 2B, as indicated by a dotted arrow 660a, the largest key “0111” of the keys “0111”, “0010”, and “0110” whose difference bit position from the reference key “1010” is 0 is displayed. The read position P1 is stored at a position where the difference bit position 611a of the difference bit position table 310a is 0. Also, as indicated by the dotted arrow 662a, the key whose difference bit position is 2 with respect to the reference key “1010” is only the key “1000”, so the read position P2 of the key “1000” is the difference bit position table 310a. Are stored in positions where the difference bit position 611a is 2.

差分ビット位置表310bは、基準キーより大であって基準キーに対する同一の差分ビット位置を有するキーのうち、最小のキーの読出位置601を親リンク612bとして差分ビット位置611b毎に格納するものである。図2Aの例示では、点線の矢印661aで示すように、基準キー“1010”との差分ビット位置が1であるキーはキー“1111”だけであるので、キー“1111”の読出位置P5が差分ビット位置表310bの差分ビット位置611bが1である位置に格納されている。また、点線の矢印663aで示すように、基準キー“1010”との差分ビット位置が3であるキーはキー“1011”だけであるので、キー“1011”
の読出位置P6が差分ビット位置表310bの差分ビット位置611bが3である位置に格納されている。
The difference bit position table 310b stores the smallest key reading position 601 among the keys that are larger than the reference key and have the same difference bit position with respect to the reference key as the parent link 612b for each difference bit position 611b. is there. In the example of FIG. 2A, as indicated by the dotted arrow 661a, the key whose difference bit position is 1 with respect to the reference key “1010” is only the key “1111”, so that the reading position P5 of the key “1111” is the difference. The difference bit position 611b of the bit position table 310b is stored at a position of 1. Further, as indicated by the dotted arrow 663a, the key whose difference bit position is 3 from the reference key “1010” is only the key “1011”, and therefore the key “1011”.
Read position P6 is stored at a position where the difference bit position 611b of the difference bit position table 310b is 3.

リンク表311は、基準キーに対する同一の差分ビット位置を有するキーにアクセスするためのものである。図に示すように、キーの読出位置621に対して、同一の差分ビット位置を有するキーの読出位置を示すリンク622が格納されている。   The link table 311 is for accessing a key having the same differential bit position with respect to the reference key. As shown in the figure, a link 622 indicating a key reading position having the same differential bit position is stored with respect to the key reading position 621.

差分ビット位置表310aからリンク表311への点線の矢印671bで示すように、同一の差分ビット位置0を有するキーの最大値キーの読出位置P1(親リンク)に対して、その読出位置P1を読出位置621とするリンク表311の読出位置(以下、リンク表311の読出位置P1のようにいう。)に、基準キー“1010”に対して差分ビット位置0を有するキーの最大値キー“0111”と同一の差分ビット位置0を有するキー“0110”のキー表309の読出位置P4が格納されている。 As indicated by the dotted arrow 671b from the difference bit position table 310a to the link table 311, the read position P1 is set to the read position P1 (parent link) of the maximum value key of the key having the same difference bit position 0. The maximum value key “0111” of the key having the difference bit position 0 with respect to the reference key “1010” at the reading position of the link table 311 as the reading position 621 (hereinafter referred to as the reading position P1 of the link table 311). The read position P4 of the key table 309 of the key “0110” having the same differential bit position 0 as “” is stored.

そして、図の点線の矢印674cで示すように、リンク表311の読出位置P4に同一の差分ビット位置0を有するキー“0010”のキー表309の読出位置P3が格納されている。また、図の点線の矢印673cで示すように、リンク表311の読出位置P3には、同一の値のキー表309の読出位置P3が格納されている。これにより、それ以上同一の差分ビット位置0を有するキーは存在しないことを表している。 As indicated by a dotted arrow 674c in the figure, the reading position P3 of the key table 309 of the key “0010” having the same differential bit position 0 is stored at the reading position P4 of the link table 311. Further, as indicated by a dotted arrow 673c in the figure, the reading position P3 of the key table 309 having the same value is stored in the reading position P3 of the link table 311. This indicates that there is no more key having the same differential bit position 0.

また、差分ビット位置表310aからリンク表311への点線の矢印672bで示すように、同一の差分ビット位置2を有するキーの最大値キーの読出位置P2(親リンク)に対して、リンク表311の読出位置P2には、リンク表311の読出位置P2と同一の値のキー表309の読出位置P2が格納されている。これは、キー表309の読出位置P2のキー“1000”が基準キー“1010”との差分ビット位置が2であるキーの最大のキーであるとともに、唯一のものであることを示している。 In addition, as indicated by a dotted arrow 672b from the difference bit position table 310a to the link table 311, the link table 311 with respect to the reading position P2 (parent link) of the maximum value key of the key having the same difference bit position 2 The read position P2 of the key table 309 having the same value as the read position P2 of the link table 311 is stored in the read position P2. This indicates that the key “1000” at the reading position P2 in the key table 309 is the largest key of the key whose difference bit position is 2 from the reference key “1010” and is unique.

一方、差分ビット位置表310bからリンク表311への点線の矢印675bで示すように、基準キーとの同一の差分ビット位置1を有するキーの最小値キーの読出位置P5(親リンク)に対して、リンク表311の読出位置P5には、リンク表311の読出位置P5と同一の値のキー表309の読出位置P5が格納されている。これは、キー表309の読出位置P5のキー“1111”が基準キー“1010”との差分ビット位置が1であるキーの最小のキーであるとともに、唯一のものであることを示している。 On the other hand, as indicated by a dotted arrow 675b from the difference bit position table 310b to the link table 311, with respect to the reading position P5 (parent link) of the minimum value key of the key having the same difference bit position 1 with the reference key. The read position P5 of the key table 309 having the same value as the read position P5 of the link table 311 is stored in the read position P5 of the link table 311. This indicates that the key “1111” at the reading position P5 in the key table 309 is the smallest key of the key whose difference bit position is 1 from the reference key “1010” and is unique.

同様に、差分ビット位置表310bからリンク表311への点線の矢印676bで示すように、基準キーとの同一の差分ビット位置3を有するキーの最小値キーの読出位置P5に対して、リンク表311の読出位置P5には、リンク表311の読出位置P6と同一の値のキー表309の読出位置P6が格納されている。これは、キー表309の読出位置P6のキー“1011”が基準キー“1010”との差分ビット位置が3であるキーの最小のキーであるとともに、唯一のものであることを示している。 Similarly, as indicated by a dotted arrow 676b from the difference bit position table 310b to the link table 311, the link table for the minimum value key reading position P5 of the key having the same difference bit position 3 with the reference key is shown. The reading position P5 of 311 stores the reading position P6 of the key table 309 having the same value as the reading position P6 of the link table 311. This indicates that the key “1011” at the reading position P6 in the key table 309 is the smallest key of the key whose difference bit position is 3 from the reference key “1010” and is unique.

上述の図2Bに示す差分ビット位置表310a、310bとリンク表311の状態は、図2Aに示す差分ビット位置による分類149aが実行されて得られるものである。
以上の説明から明らかなとおり、上述のキー表309は請求項1に係る発明のソート対象キー記憶手段の一実施例である。また、差分ビット位置表310a、310bとリンク表311で分類対象キー差分ビット位置記憶手段の一実施例を構成しており、キー表309の読出位置601はキーの識別情報に相当する。
The states of the difference bit position tables 310a and 310b and the link table 311 shown in FIG. 2B described above are obtained by executing the classification 149a based on the difference bit positions shown in FIG. 2A.
As is apparent from the above description, the key table 309 described above is an example of the sort target key storage means of the invention according to claim 1. The difference bit position tables 310a and 310b and the link table 311 constitute one embodiment of the classification target key difference bit position storage means, and the read position 601 of the key table 309 corresponds to key identification information.

図2Cは、本発明の一実施の形態におけるビット列データソート装置の機能ブロック構成例を説明する図である。
図に示すように、ビット列データソート装置200は、グループ分け手段205、差分ビット位置計算手段210、差分ビット位置分類手段220、ソート済みキー出力手段230、及び制御手段240を含む。以下、各手段の動作の概要について、図2Bの例示を参照して説明する。
FIG. 2C is a diagram illustrating a functional block configuration example of the bit string data sorting device according to one embodiment of the present invention.
As shown in the figure, the bit string data sorting apparatus 200 includes a grouping unit 205, a difference bit position calculation unit 210, a difference bit position classification unit 220, a sorted key output unit 230, and a control unit 240. Hereinafter, an outline of the operation of each unit will be described with reference to the example of FIG. 2B.

グループ分け手段205は、キー表309に記憶された全てのソート対象のキーと基準キーの大小比較を行い、基準キーより小さいキーのグループと基準キーより大きいキーのグループのグループ分けを行う。差分ビット位置計算手段210は、キー表309に記憶されたキー602のうちの、差分ビット位置による分類処理の対象となるキーと差分ビット位置を計算する基準となるキーの差分ビット位置を計算する。差分ビット位置を計算する最初の基準となるキーは基準キーである。
差分ビット位置分類手段220は、基準キーより小さいキーのグループについての差分ビット位置計算手段210の最初の計算結果に基づいて、差分ビット位置表310aとリンク表311の書き込みを行い、基準キーより大きいキーのグループについての差分ビット位置計算手段210の最初の計算結果に基づいて、差分ビット位置表310bとリンク表311の書き込みを行うことで、キーの差分ビット位置による分類を行う。
最初の分類の結果として、基準キーより小さいキーのグループは、キーの識別情報をキー表309の読出位置601として、差分ビット位置が0の組(P1、P4、P3)と差分ビット位置が2の組(P2)に分類される。また、基準キーより大きいキーのグループは、差分ビット位置が1の組(P5)と差分ビット位置が3の組(P6)に分類される。
The grouping unit 205 compares the size of all sort target keys stored in the key table 309 with the reference key, and performs grouping of a group of keys smaller than the reference key and a group of keys larger than the reference key. The difference bit position calculation means 210 calculates the difference bit position of the key to be classified by the difference bit position and the reference key for calculating the difference bit position among the keys 602 stored in the key table 309. . The first reference key for calculating the difference bit position is the reference key.
The difference bit position classification means 220 writes the difference bit position table 310a and the link table 311 based on the first calculation result of the difference bit position calculation means 210 for the key group smaller than the reference key, and is larger than the reference key. Based on the first calculation result of the difference bit position calculation unit 210 for the key group, the difference bit position table 310b and the link table 311 are written to perform classification based on the difference bit position of the key.
As a result of the first classification, a group of keys smaller than the reference key has a key identification information as a reading position 601 in the key table 309, a set of difference bit positions of 0 (P1, P4, P3) and a difference bit position of 2 (P2). Key groups larger than the reference key are classified into a pair (P5) with a difference bit position of 1 and a set (P6) with a difference bit position of 3.

制御手段240は、キー表309に格納されたキーをグループ分け手段205により基準キーより小さいキーのグループと大きいグループにグループ分けする。そして、最初の分類処理の対象をキー表309に記憶された基準キーより小さい全てのキーと基準キーより大きい全てのキーとする。この場合、差分ビット位置を計算する基準となる基準キーは、読出位置P0に格納されたキー“1010”である。ソート済みキー出力手段230は、この基準キー“1010をソート済みキー表313に出力する。   The control unit 240 groups the keys stored in the key table 309 into a group of keys smaller than the reference key and a larger group by the grouping unit 205. The target of the first classification process is set to all keys smaller than the reference key stored in the key table 309 and all keys larger than the reference key. In this case, the reference key serving as a reference for calculating the difference bit position is the key “1010” stored at the reading position P0. The sorted key output unit 230 outputs the reference key “1010” to the sorted key table 313.

制御手段240は、分類後に複数のキーが含まれる組について、さらに差分ビット位置計算手段210による差分ビット位置の計算と差分ビット位置分類手段220による分類処理が繰り返されるように制御する。   The control unit 240 performs control so that the difference bit position calculation by the difference bit position calculation unit 210 and the classification process by the difference bit position classification unit 220 are repeated for a set including a plurality of keys after classification.

図3は、本発明を実施するためのハードウェア構成例を説明する図である。
本発明によるソート処理は中央処理装置302及びキャッシュメモリ303を少なくとも備えたデータ処理装置301によりデータ格納装置308を用いて実施される。キー表309、差分ビット位置表310a、差分ビット位置表310b、リンク表311、ソート済みキー表313を有するデータ格納装置308は、主記憶装置305または外部記憶装置306で実現することができ、あるいは通信装置307を介して接続された遠方に配置された装置を用いることも可能である。
FIG. 3 is a diagram for explaining a hardware configuration example for carrying out the present invention.
Sort processing according to the present invention is performed by a data processing device 301 including at least a central processing unit 302 and a cache memory 303 using a data storage device 308. The data storage device 308 having the key table 309, the difference bit position table 310a, the difference bit position table 310b, the link table 311 and the sorted key table 313 can be realized by the main storage device 305 or the external storage device 306, or It is also possible to use a remote device connected via the communication device 307.

図3の例示では、主記憶装置305、外部記憶装置306及び通信装置307が一本のバス304によりデータ処理装置301に接続されているが、接続方法はこれに限るものではない。また、主記憶装置305をデータ処理装置301内のものとすることもできるし、キー表309は外部記憶装置306に、他の表は主記憶装置305に持つなど、使用可能なハードウェア環境、ソート対象キーの集合の大きさ等に応じて適宜ハードウェア構成を選択できることは明らかである。   In the example of FIG. 3, the main storage device 305, the external storage device 306, and the communication device 307 are connected to the data processing device 301 by a single bus 304, but the connection method is not limited to this. In addition, the main storage device 305 can be in the data processing device 301, the key table 309 is in the external storage device 306, and other tables are in the main storage device 305. It is obvious that the hardware configuration can be appropriately selected according to the size of the set of sorting target keys.

また、特に図示されてはいないが、処理の途中で得られた各種の値を後の処理で用いるためにそれぞれの処理に応じた主記憶装置305の一時記憶領域が用いられることは当然である。そして、以下の説明においては、一次記憶領域に格納されるあるいは設定される値を一時記憶領域の名前で呼ぶことがある。   Although not particularly illustrated, it is natural that the temporary storage area of the main storage device 305 corresponding to each process is used in order to use various values obtained during the process in the subsequent process. . In the following description, a value stored or set in the primary storage area may be referred to as a temporary storage area name.

次に、本発明の一実施の形態におけるソート処理について、図4を参照してその概要を説明する。また、その説明において、図2Aあるいは図2Bの例示を適宜用いて説明する。   Next, an outline of the sorting process according to the embodiment of the present invention will be described with reference to FIG. Moreover, in the description, it demonstrates using the illustration of FIG. 2A or FIG. 2B suitably.

図4は、本発明の一実施の形態におけるソート処理全体の処理フロー例を説明する図である。キー表にはソート対象のキーが記憶されていることを前提とする。すなわち、図2Aに示すキー列100に含まれるキーは図2Bに示すようにキー表309に記憶されているものとする。   FIG. 4 is a diagram for explaining an example of the processing flow of the entire sort processing in one embodiment of the present invention. It is assumed that the key to be sorted is stored in the key table. That is, the keys included in the key string 100 shown in FIG. 2A are stored in the key table 309 as shown in FIG. 2B.

まず、ステップS401において、キー表の先頭位置をキー表の読出位置(以下、単に読出位置ということがある。)に設定する。ここでいう「キー表の読出位置」は、先に述べた「処理の途中で得られた各種の値を後の処理で用いるためにそれぞれの処理に応じた一時記憶領域」の1つである。以下の説明では、「キー表の先頭位置をキー表の読出位置に設定する。」のように、「キー表の読出位置」が図示しない一次記憶領域であることを省略して述べることがある。
上記の設定により、図2Bの例示では、キー表の読出位置にP0が設定される。
First, in step S401, the head position of the key table is set to a key table reading position (hereinafter, simply referred to as a reading position). The “reading position of the key table” here is one of the “temporary storage areas corresponding to each processing in order to use various values obtained during the processing in the subsequent processing” described above. . In the following description, it is sometimes omitted that “the key table read position” is a primary storage area (not shown), such as “the head position of the key table is set as the key table read position”. .
With the above setting, in the example of FIG. 2B, P0 is set at the reading position of the key table.

次にステップS402において、キー表より、先頭位置の指すキーを基準キーとして取り出す。ここでいう「基準キーとして取り出す」は、一時記憶領域である基準キーに設定する、の意味である。この一時記憶領域は、ほとんどの場合図示されていない。以下においても、同様な表記を用いる場合がある。 In step S402, the key indicated by the head position is extracted from the key table as a reference key. Here, “take out as a reference key” means to set a reference key which is a temporary storage area. This temporary storage area is not shown in most cases. In the following, similar notation may be used.

ステップS403に進み、読出位置に次の読出位置を設定する。次にステップS404において、全てのキーは処理済みか、すなわち、全てのキーについての初段における分類処理が終了したか判定する。   Proceeding to step S403, the next reading position is set as the reading position. Next, in step S404, it is determined whether all the keys have been processed, that is, whether the classification process at the first stage for all the keys has been completed.

全てのキーが処理済みでなければ、ステップS405に進み、キー表より、読出位置の指すキーをソートキーとして取り出すとともに、読出位置をソートキーの読出位置に設定する。そしてステップS406において、ソートキーと基準キーの差分ビット位置を得て、差分ビット位置によりソートキーを分類し、ステップS403に戻る。
ステップS406の処理においては、初段における分類処理として差分ビット位置表とリンク表への設定が行われる。その処理の詳細については、後に図5、図6A及び図6B、図7A及び図7Bを参照して説明する。
If all the keys have not been processed, the process proceeds to step S405, where the key pointed to by the reading position is extracted from the key table as a sort key, and the reading position is set as the reading position of the sort key. In step S406, a difference bit position between the sort key and the reference key is obtained, the sort key is classified based on the difference bit position, and the process returns to step S403.
In the process of step S406, the difference bit position table and the link table are set as the classification process in the first stage. Details of the processing will be described later with reference to FIGS. 5, 6A and 6B, and FIGS. 7A and 7B.

一方、ステップS404で全てのキーが処理済みであると判定されると、ステップS407に分岐する。
ステップS407では、差分ビット位置表に、基準キーより小さいソートキーの差分ビット位置表を設定し、ステップS408に進んで基準キーより小さいソートキーを差分ビット位置順に取り出す。
On the other hand, if it is determined in step S404 that all keys have been processed, the process branches to step S407.
In step S407, the difference bit position table of the sort key smaller than the reference key is set in the difference bit position table, and the process proceeds to step S408 to extract the sort keys smaller than the reference key in the order of the difference bit position.

ここで、ステップS407での「差分ビット位置表に、基準キーより小さいソートキーの差分ビット位置表を設定し、」とは、次のステップS408で処理対象とする差分ビット位置表を基準キーより小さいソートキーの差分ビット位置表とすることであり、図2Bの例示では、差分ビット位置表310aを用いた処理が行われるようにすることである。例えば差分ビット位置表のアドレスを、基準キーより小さいソートキーの差分ビット位置表のアドレスとすることにより実行される。上述の「差分ビット位置表に、基準キーより小さいソートキーの差分ビット位置表を設定し、」の意味は、以下のその他のステップにおいても同様であり、また、「差分ビット位置表に、基準キーより大きいソートキーの差分ビット位置表を設定し、」という場合も、同様に次のステップで処理対象とする差分ビット位置表を基準キーより大きいソートキーの差分ビット位置表とすることである。   Here, “the difference bit position table of the sort key smaller than the reference key is set in the difference bit position table in step S407” means that the difference bit position table to be processed in the next step S408 is smaller than the reference key. The difference bit position table of the sort key is used. In the example of FIG. 2B, the process using the difference bit position table 310a is performed. For example, it is executed by setting the address of the difference bit position table as the address of the difference bit position table of the sort key smaller than the reference key. The meaning of “set a difference bit position table for a sort key smaller than the reference key in the difference bit position table” described above is the same in the following other steps. Similarly, in the case of setting a difference bit position table of a larger sort key, the difference bit position table to be processed in the next step is to be a difference bit position table of a sort key larger than the reference key.

また、ステップS408での「ソートキーを差分ビット位置順に取り出す」とは、基準キーに対する差分ビット位置の昇順あるいは降順にソートキーを取り出し、同一の差分ビット位置を有する複数のソートキーの組に対してはその組内の基準キーに対する差分ビット位置の昇順あるいは降順にソートキーを取り出すことを、全てのキーを差分ビット位置により分離して取り出すまで繰り返すことである。
ステップS408の処理の詳細は、後に図8及び図9を参照して説明する。
In step S408, “retrieve the sort key in the order of the difference bit position” means that the sort key is taken out in the ascending or descending order of the difference bit position with respect to the reference key, and for a set of a plurality of sort keys having the same difference bit position, The extraction of the sort keys in ascending or descending order of the difference bit positions with respect to the reference key in the set is repeated until all the keys are separated and extracted by the difference bit positions.
Details of the processing in step S408 will be described later with reference to FIGS.

ステップS408に引き続き、ステップ409において、ステップS402で得た基準キーをソート済みキー表に設定する。
続いてステップS410で、差分ビット位置表に、基準キーより大きいソートキーの差分ビット位置表を設定し、ステップS411に進んで基準キーより大きいソートキーを差分ビット位置順に取り出して処理を終了する。
ステップS411の処理の詳細は、後に図10及び図11を参照して説明する。
Subsequent to step S408, in step 409, the reference key obtained in step S402 is set in the sorted key table.
Subsequently, in step S410, the difference bit position table of the sort key larger than the reference key is set in the difference bit position table, the process proceeds to step S411, the sort keys larger than the reference key are extracted in the order of the difference bit position, and the process is terminated.
Details of the processing in step S411 will be described later with reference to FIGS.

次に、図4に示すステップS406、ステップS408及びステップS411の処理の詳細を説明する。
図5は、図4に示すステップS406の処理を詳細に説明するものであり、本発明の一実施の形態における基準キーより小さいソートキーのグループと大きいソートキーのグループについてそれぞれ差分ビット位置により分類する処理フロー例を説明する図である。
Next, details of the processing of step S406, step S408, and step S411 shown in FIG. 4 will be described.
FIG. 5 explains in detail the process of step S406 shown in FIG. 4, and the process of classifying the sort key group smaller than the reference key and the larger sort key group according to the difference bit position in the embodiment of the present invention. It is a figure explaining the example of a flow.

始めに、ステップS501において、ソートキーは基準キーより大きいか判定する。ソートキーは、図4に示すステップS405でキー表から取り出されたものである。
ソートキーが基準キーより大きければ、ステップS502に進み、ソートキーが基準キーより小さければ、ステップS504に進む。ステップS501の処理により、ソートキーは、基準キーより小さいグループと基準キーより大きいグループにグループ分けされる。そして、グループ毎にソートキーの分類処理が行われる。
First, in step S501, it is determined whether the sort key is larger than the reference key. The sort key is extracted from the key table in step S405 shown in FIG.
If the sort key is larger than the reference key, the process proceeds to step S502. If the sort key is smaller than the reference key, the process proceeds to step S504. By the processing in step S501, the sort keys are grouped into a group smaller than the reference key and a group larger than the reference key. Then, a sort key classification process is performed for each group.

ステップS502では、差分ビット位置表に、基準キーより大きいソートキーの差分ビット位置表を設定する。そして、ステップS503に進んで、基準キーより大きいソートキーと基準キーの差分ビット位置によりソートキーを分類し、処理を終了する。ステップS503の処理の詳細は、後に図6A及び図6Bを参照して説明する。   In step S502, the difference bit position table of the sort key larger than the reference key is set in the difference bit position table. Then, the process proceeds to step S503, where the sort key is classified based on the difference bit position between the sort key larger than the reference key and the reference key, and the process ends. Details of the processing in step S503 will be described later with reference to FIGS. 6A and 6B.

一方、ステップS504に進んだ場合は、差分ビット位置表に、基準キーより小さいソートキーの差分ビット位置表を設定する。そして、ステップS505に進んで、基準キーより小さいソートキーと基準キーの差分ビット位置によりソートキーを分類し、処理を終了する。ステップS505の処理の詳細は、後に図7A及び図7Bを参照して説明する。   On the other hand, if the process proceeds to step S504, the difference bit position table of the sort key smaller than the reference key is set in the difference bit position table. Then, the process proceeds to step S505, where the sort key is classified based on the difference bit position between the sort key smaller than the reference key and the reference key, and the process ends. Details of the processing in step S505 will be described later with reference to FIGS. 7A and 7B.

次に図6A及び図6Bを参照して本発明の一実施の形態における基準キーより大きいソートキーのグループを分類する処理を説明する。図6A及び図6Bに記載するものは、図5に示すステップS503の処理、及び後述の図11に示すステップS1103の処理の詳細な処理フロー例である。
図6Aは、本発明の一実施の形態における基準キーより大きいソートキーのグループを分類する処理の前段の処理フロー例を説明する図である。
Next, with reference to FIG. 6A and FIG. 6B, processing for classifying a group of sort keys larger than the reference key in one embodiment of the present invention will be described. 6A and 6B are detailed process flow examples of the process in step S503 shown in FIG. 5 and the process in step S1103 shown in FIG. 11 described later.
FIG. 6A is a diagram for explaining an example of the processing flow in the previous stage of the processing for classifying a group of sort keys larger than the reference key in one embodiment of the present invention.

図6Aに示すように、ステップS601で、ソートキーに設定されているキーと基準キーに設定されているキーをビット列として比較し、上位0ビット目からみた最初の不一致ビットのビット位置を、差分ビット位置に設定する。ソートキーは、図4に示すステップS405、あるいは後述の図11に示すステップS1101で設定されるものであり、図6A及び図6Bに示す分類処理の対象のキーである。 As shown in FIG. 6A, in step S601, the key set as the sort key and the key set as the reference key are compared as a bit string, and the bit position of the first non-matching bit viewed from the upper 0 bit is represented as a difference bit. Set to position. The sort key is set in step S405 shown in FIG. 4 or step S1101 shown in FIG. 11 described later, and is a target key for the classification process shown in FIGS. 6A and 6B.

次にステップS602で差分ビット位置表より、ステップS601で設定した差分ビット位置の指す親リンクを読み出し、ステップS603で親リンクは設定済みであるか判定する。親リンクが設定済みでなければ、ステップS604に進み、差分ビット位置表の、差分ビット位置の指す親リンクにソートキーの読出位置を設定し、ステップS605において、リンク表の、ソートキーの読出位置の指すリンクに、ソートキーの読出位置を設定して処理を終了する。 In step S602, the parent link pointed to by the difference bit position set in step S601 is read from the difference bit position table. In step S603, it is determined whether the parent link has been set. If the parent link has not been set, the process proceeds to step S604, where the sort key read position is set to the parent link pointed to by the difference bit position in the difference bit position table, and in step S605, the sort key read position is indicated. The sorting key reading position is set for the link, and the process is terminated.

差分ビット位置表には、先に述べたように同一の差分ビット位置を有するキーのうち、最大のキーの読出位置が親リンクとして格納されるが、上記ステップS604の処理は、最初のソートキーを仮の最大値キーとして、ソートキーの読出位置を差分ビット位置表の差分ビット位置の指す親リンクに設定するものである。一旦親リンクが設定済みとなった後、すなわちステップS603での判定が親リンクは設定済みになると、図6Bに示す後段の処理に進み、ソートキーと最大値キーの大小比較による最大値キーの更新が行われ、最終的には同一の差分ビット位置を有するキーのうち、最大のキーの読出位置が親リンクとして差分ビット位置表に格納される。   In the difference bit position table, as described above, the reading position of the largest key among the keys having the same difference bit position is stored as the parent link. However, in the process of step S604, the first sort key is stored. As the provisional maximum value key, the read position of the sort key is set to the parent link pointed to by the difference bit position in the difference bit position table. Once the parent link has been set, that is, when the determination in step S603 has been set, the process proceeds to the subsequent process shown in FIG. 6B, and the maximum value key is updated by comparing the sort key and the maximum value key. Finally, among the keys having the same differential bit position, the reading position of the largest key is stored in the differential bit position table as a parent link.

図6Bは、本発明の一実施の形態における基準キーより大きいソートキーのグループを分類する処理の後段の処理フロー例を説明する図である。
図6Bに示すように、ステップS606で、キー表より、親リンクの指すキーを、親ソートキーとして読み出し、ステップS607において、ソートキーは親ソートキーより大きいか判定する。
ステップS607でソートキーは親ソートキーより大きいと判定されると、ステップS608に進み、差分ビット位置表の、差分ビット位置の指す親リンクにソートキーの読出位置を設定し、ステップS609でリンク表の、ソートキーの読出位置の指すリンクに、ステップS602で得た親リンクを設定して処理を終了する。
FIG. 6B is a diagram illustrating a processing flow example at the latter stage of the process of classifying a group of sort keys larger than the reference key in one embodiment of the present invention.
As shown in FIG. 6B, in step S606, the key pointed to by the parent link is read from the key table as a parent sort key. In step S607, it is determined whether the sort key is larger than the parent sort key.
If it is determined in step S607 that the sort key is larger than the parent sort key, the process advances to step S608 to set the read position of the sort key in the parent link pointed to by the difference bit position in the difference bit position table, and in step S609, the sort key of the link table. The parent link obtained in step S602 is set to the link pointed to by the reading position, and the process ends.

上述のステップS608の処理は、差分ビット位置表の差分ビット位置の指す親リンクに同一の差分ビット位置を有するキーのうちで最大のキーの読出位置を設定するために、より大きいキーの読出位置で親リンクを更新するものである。そして、ステップS609の処理は、差分ビット位置表に新たに設定されたソートキーの読出位置の指すリンク表のリンクに、差分ビット位置表に設定されていた親リンクを設定することで、リンク表に、同一の差分ビット位置を有するキーのキー表における読出位置をたどるための情報を保持させるものである。 The processing in step S608 described above is performed in order to set the reading position of the largest key among the keys having the same difference bit position in the parent link pointed to by the difference bit position in the difference bit position table. To update the parent link. Then, the process of step S609 sets the parent link set in the difference bit position table to the link of the link table pointed to by the read position of the sort key newly set in the difference bit position table. The information for tracing the reading position in the key table of the key having the same differential bit position is held.

一方、ステップS607でソートキーは親ソートキーより大きくないと判定されると、ステップS610に進み、リンク表より、親リンクの指すリンクを次リンクとして読み出し、ステップS611で、次リンクと親リンクは同一か判定する。   On the other hand, if it is determined in step S607 that the sort key is not larger than the parent sort key, the process proceeds to step S610, and the link pointed to by the parent link is read from the link table as the next link. In step S611, the next link and the parent link are the same. judge.

ステップS611で次リンクと親リンクは同一であると判定されると、ステップS612において、リンク表の親リンクの指すリンクに、ソートキーの読出位置を設定する。そして、ステップS613において、リンク表のソートキーの読出位置の指すリンクに、ソートキーの読出位置を設定して処理を終了する。   If it is determined in step S611 that the next link and the parent link are the same, in step S612, the read position of the sort key is set to the link pointed to by the parent link in the link table. In step S613, the sorting key reading position is set in the link indicated by the sorting key reading position in the link table, and the process ends.

一方、ステップS611で次リンクと親リンクは同一でないと判定されると、ステップS614に進み、リンク表の親リンクの指すリンクに、ソートキーの読出位置を設定する。そして、ステップS615において、リンク表のソートキーの読出位置の指すリンクに、ステップS610で得た次リンクを設定して処理を終了する。   On the other hand, if it is determined in step S611 that the next link and the parent link are not the same, the process advances to step S614 to set the sort key reading position for the link indicated by the parent link in the link table. In step S615, the next link obtained in step S610 is set to the link pointed to by the reading position of the sort key in the link table, and the process ends.

上述のステップS611の判定は、同一の差分ビット位置を有するキーのうちで分類済みのキーが1つのみであったかの判定と同じである。分類済みのキーが1つのみであればこのキーの読出位置の指すリンク表のリンクにはその読出位置が格納されている。そこで、それをソートキーの読出位置で更新し、ソートキーの読出位置の指すリンク表のリンクにソートキーの読出位置を設定してソートキーが、その時点での最後の分類済みのキーであることを示す。分類済みのキーが2つ以上のときは、ステップS614とステップS615の処理により、リンク表で表現される親リンクと次リンクのリンク関係の間に、ソートキーの読出位置を挿入する。   The determination in step S611 described above is the same as the determination as to whether there is only one classified key among keys having the same differential bit position. If there is only one classified key, the read position is stored in the link of the link table indicated by the read position of this key. Therefore, it is updated at the read position of the sort key, and the read position of the sort key is set in the link of the link table pointed to by the read position of the sort key to indicate that the sort key is the last classified key at that time. When there are two or more classified keys, the sorting key reading position is inserted between the link relationship between the parent link and the next link expressed in the link table by the processing of step S614 and step S615.

次に図7A及び図7Bを参照して本発明の一実施の形態における基準キーより小さいソートキーのグループを分類する処理を説明する。図7A及び図7Bに記載するものは、図5に示すステップS505の処理、及び後述の図9に示すステップS903の処理の詳細な処理フロー例である。 Next, with reference to FIGS. 7A and 7B, processing for classifying a group of sort keys smaller than the reference key in one embodiment of the present invention will be described. 7A and 7B are detailed process flow examples of the process in step S505 shown in FIG. 5 and the process in step S903 shown in FIG. 9 described later.

基準キーより小さいソートキーのグループの分類についての図7A及び図7Bの記載と基準キーより大きいソートキーのグループの分類についての図6A及び図6Bの記載を比較すると、図7Aと図6Aに示す前段の処理フロー例は同一である。また、図7Bと図6Bに示す後段の処理フロー例も、ソートキーと親ソートキーを比較する図7BのステップS707ではソートキーは親ソートキーより小さいか判定するのに対し、図6BのステップS607ではソートキーは親ソートキーより大きいか判定することで異なるだけで、他のステップは実質的に同一である。
したがって、図7A及び図7Bを参照する本発明の一実施の形態における基準キーより小さいソートキーのグループを分類する処理の説明は以上で終了する。
FIG. 7A and FIG. 7B regarding the classification of the sort key group smaller than the reference key and the description of FIG. 6A and FIG. 6B regarding the classification of the sort key group larger than the reference key are compared. The processing flow examples are the same. 7B and FIG. 6B also show a processing flow in the latter stage, in which the sort key is compared with the parent sort key in step S707 in FIG. 7B, and it is determined whether the sort key is smaller than the parent sort key, whereas in step S607 in FIG. The other steps are substantially the same, only differing by determining whether it is greater than the parent sort key.
Therefore, the description of the process of classifying a group of sort keys smaller than the reference key in the embodiment of the present invention with reference to FIGS. 7A and 7B is completed.

次に、図4に示すステップ408の処理の詳細を説明する。
図8は、本発明の一実施の形態における基準キーより小さいソートキーを差分ビット位置順に取り出す処理の処理フロー例を説明する図であり、図4に示すステップ408の処理の詳細を説明する図である。
Next, details of the processing in step 408 shown in FIG. 4 will be described.
FIG. 8 is a diagram for explaining a processing flow example of processing for extracting a sort key smaller than the reference key in order of difference bit position in the embodiment of the present invention, and is a diagram for explaining details of processing in step 408 shown in FIG. is there.

図8に示すように、ステップS801において、図示しない一次記憶領域である差分ビット位置に、初期値として差分ビット位置表の差分ビット位置、すなわちソート対象のキーが有する可能性のある差分ビット位置の最大値を設定する。図2Bの例示では、差分ビット位置の最大値として3が設定される。   As shown in FIG. 8, in step S801, the difference bit position in the difference bit position table, which is the primary storage area (not shown), of the difference bit position in the difference bit position table as an initial value, that is, the difference bit position that the sort target key may have. Set the maximum value. In the example of FIG. 2B, 3 is set as the maximum value of the difference bit position.

ステップS802において、差分ビット位置表の全ての差分ビット位置のエントリについて処理済みであるか判定し、処理済みであればソート処理を終了し、処理済みでなければステップS803に進む。   In step S802, it is determined whether entries for all the difference bit positions in the difference bit position table have been processed. If processed, the sort process is terminated, and if not processed, the process proceeds to step S803.

ステップS803では、差分ビット位置表より、差分ビット位置の指すエントリから親リンクを読み出す。差分ビット位置の指すエントリに親リンクが設定されていれば、この読み出された親リンクは一次記憶領域である親リンクに設定される。すなわち、本実施の態様の説明における「親リンクを読み出す」等の表記は、親リンクを読み出して図示しない一次記憶領域である親リンクに設定することを意味することがある。親リンク以外のものに対しても同様である。   In step S803, the parent link is read from the entry indicated by the difference bit position from the difference bit position table. If a parent link is set in the entry pointed to by the difference bit position, the read parent link is set as a parent link which is a primary storage area. That is, a notation such as “read parent link” in the description of this embodiment may mean that the parent link is read and set to a parent link which is a primary storage area (not shown). The same applies to items other than the parent link.

次のステップS804では、ステップS803で差分ビット位置の指すエントリから読み出した親リンクは設定済みであるか判定する。設定済みでなければステップS809に分岐して差分ビット位置から値を1減らしてステップS802に戻り、一方、設定済みであればステップS805に進む。図2Bの例示では、最大値である差分ビット位置3には親リンクは設定されておらず、差分ビット位置2と差分ビット位置0にそれぞれ親リンクP2、P1が設定されている。 In the next step S804, it is determined whether the parent link read from the entry indicated by the difference bit position in step S803 has been set. If not set, the process branches to step S809, the value is decremented by 1 from the difference bit position, and the process returns to step S802. If set, the process proceeds to step S805. In the example of FIG. 2B, the parent link is not set in the differential bit position 3 that is the maximum value, and the parent links P2 and P1 are set in the differential bit position 2 and the differential bit position 0, respectively.

ステップS805では、キー表より、ステップS803で設定した親リンク(キー表の読出位置)の指すキーをソート済みキーとして取り出し、その取り出したソート済みキーをソート済みキー表に設定する。先に説明したように、差分ビット位置表にその読出位置が格納されているキーは、同一の差分ビット位置に分類されたキーのうちの最大値キーであるので、ステップS805でソート済みキー表に設定する。図2Bの例示では、差分ビット位置2においては、親リンクP2の指すキー表のキー“1000”をソート済みキーとして取り出し、ソート済みキー表に設定する。差分ビット位置0においては、親リンクP1の指すキー表のキー“0111”をソート済みキーとして取り出し、ソート済みキー表に設定する。   In step S805, the key pointed to by the parent link (key table read position) set in step S803 is extracted from the key table as a sorted key, and the extracted sorted key is set in the sorted key table. As described above, since the key whose read position is stored in the difference bit position table is the maximum value key among the keys classified into the same difference bit position, the sorted key table in step S805. Set to. In the example of FIG. 2B, at the difference bit position 2, the key “1000” in the key table pointed to by the parent link P2 is extracted as a sorted key and set in the sorted key table. At the difference bit position 0, the key “0111” in the key table pointed to by the parent link P1 is extracted as a sorted key and set in the sorted key table.

次にステップS806で、リンク表より、ステップS803で設定した親リンクの指すリンクを次リンクとして読み出し、ステップS807で、差分ビット位置表の、差分ビット位置の指す親リンクを削除してステップS808に進む。ここで差分ビット位置表の差分ビット位置の指す親リンクを削除するのは、キー表の読出位置が親リンクである最大値キーの分類処理はステップS805で完了しており、もはや差分ビット位置表上のこの親リンクは必要がないことと、この親リンクが差分ビット位置表に残っていることによる後続の処理への影響を避けるためである。   In step S806, the link pointed to by the parent link set in step S803 is read from the link table as the next link. In step S807, the parent link pointed to by the difference bit position in the difference bit position table is deleted, and the flow returns to step S808. move on. Here, the parent link pointed to by the difference bit position in the difference bit position table is deleted because the classification process of the maximum value key whose read position of the key table is the parent link has been completed in step S805, and is no longer in the difference bit position table. This is because the above parent link is not necessary and the influence on the subsequent processing due to this parent link remaining in the difference bit position table is avoided.

ステップS808では、ステップS806で読み出した次リンクとステップS803で設定した親リンクが同一であるか判定する。
ステップS808で次リンクと親リンクが同一であると判定されると、先に説明したステップS809を経由してステップS802に戻る。
上述のステップS802〜ステップS809のループ処理により、差分ビット位置の降順でソート済みキーの取り出しとソート済みキー表への格納が行われる。より大きい差分ビット位置を有するキーの値がより基準キーの値に近いので、差分ビット位置の降順でソート済みキーを取り出すことにより、降順でソート済みキーが取り出される。
In step S808, it is determined whether the next link read in step S806 and the parent link set in step S803 are the same.
If it is determined in step S808 that the next link and the parent link are the same, the process returns to step S802 via step S809 described above.
By the loop processing from step S802 to step S809 described above, the sorted key is extracted and stored in the sorted key table in descending order of the difference bit position. Since the value of the key having the larger difference bit position is closer to the value of the reference key, the sorted key is extracted in descending order by extracting the sorted key in descending order of the difference bit position.

したがって、基準キーより小さいソートキーを格納する第1のソート済みキー表を基準キーより大きいソートキーを格納する第2のソート済みキー表とは別に設け、第1のソート済みキー表のアドレスの大きい方から小さい方に向かって降順でソート済みキーを格納することにより、第1のソート済みキー表からソート済みキーを昇順で読み出すことができる。
また、図5に示すステップS501の判定結果に応じて基準キーより小さいソートキーと基準キーより大きいソートキーの数をカウントし、ソート済みキー表の、基準キーより小さいソートキーを格納する範囲と基準キーを格納する位置と基準キーより大きいソートキーを格納する範囲を決めることもできる。
Therefore, the first sorted key table storing the sort key smaller than the reference key is provided separately from the second sorted key table storing the sort key larger than the reference key, and the one having the larger address of the first sorted key table is stored. By storing the sorted keys in descending order from the first to the smaller, the sorted keys can be read from the first sorted key table in ascending order.
Further, the number of sort keys smaller than the reference key and the number of sort keys larger than the reference key are counted according to the determination result of step S501 shown in FIG. 5, and the range and reference key for storing the sort key smaller than the reference key in the sorted key table are stored. It is also possible to determine the storage location and the range for storing the sort key larger than the reference key.

さらに、基準キーより小さいソートキーを昇順に取り出すために、差分ビット位置表の親リンクには最小値を設定し、差分ビット位置の昇順でソートキーをソート済みキーとして取り出すこともできる。ただし差分ビット位置の昇順で処理を行う場合には、同一の差分ビット位置の複数のキーがあり、後述の差分ビット位置による細分類を行うと、元の差分ビット位置表のデータが破壊される可能性があるため、別途細分類用の差分ビット位置表を用意する必要がある。   Furthermore, in order to extract the sort keys smaller than the reference key in ascending order, a minimum value can be set for the parent link of the difference bit position table, and the sort keys can be extracted as sorted keys in ascending order of the difference bit positions. However, when processing is performed in ascending order of the difference bit positions, there are a plurality of keys having the same difference bit position, and if the sub-classification by the difference bit position described later is performed, the data of the original difference bit position table is destroyed. Since there is a possibility, it is necessary to prepare a differential bit position table for fine classification separately.

上述のステップS808で次リンクと親リンクが同一であると判定されるのは、親リンクが格納された差分ビット位置を有するキーが親リンクをキー表の読出位置とするキーしか存在しない場合である。図2Bの例示では、リンク表311の読出位置621がP2でリンク622がP2の場合である。また、図2Aの例示では、キー群142aがキー“1000”のみで構成され、キー群142aについての分類処理は行われない場合に相当する。そして、この場合は差分ビット位置表に親リンクが格納された差分ビット位置についての分類処理が終了したことを意味するので、差分ビット位置から値1を減らし、次の差分ビット位置についてのステップS802〜S808の処理に進む。図2Aの例示では、差分ビット位置0のキー群140aについての処理が行われる。   In step S808 described above, it is determined that the next link and the parent link are the same when the key having the difference bit position where the parent link is stored has only a key having the parent link as the reading position of the key table. is there. In the example of FIG. 2B, the reading position 621 of the link table 311 is P2, and the link 622 is P2. Further, in the example of FIG. 2A, this corresponds to the case where the key group 142a is composed of only the key “1000” and the classification process for the key group 142a is not performed. In this case, this means that the classification process for the difference bit position for which the parent link is stored in the difference bit position table has been completed. Therefore, the value 1 is reduced from the difference bit position, and step S802 for the next difference bit position is performed. The process proceeds to S808. In the example of FIG. 2A, the process for the key group 140a at the difference bit position 0 is performed.

一方、ステップS808で次リンクと親リンクが同一でないと判定されると、ステップS810に進み、基準キーにソート済みキーを設定する。ソート済みキーは上述のステップS805で取り出され、ソート済みキー表に設定されたものであり、このソート済みキーを後述の細分類における基準キーとするために、図示しない一時記憶領域である基準キーに設定する。そして、ステップS811において、同一の差分ビット位置(ステップS801またはステップS809で設定されている。)を有する複数のキーを、下位の差分ビット位置によりさらに分類(細分類)する。ステップS811の処理の詳細については、後に図9を参照して説明する。   On the other hand, if it is determined in step S808 that the next link and the parent link are not the same, the process proceeds to step S810, and the sorted key is set as the reference key. The sorted key is taken out in the above-described step S805 and set in the sorted key table. In order to use this sorted key as a reference key in sub-classification described later, a reference key which is a temporary storage area (not shown) Set to. In step S811, a plurality of keys having the same difference bit position (set in step S801 or step S809) are further classified (subclassified) by the lower-order difference bit positions. Details of the processing in step S811 will be described later with reference to FIG.

ステップS808で次リンクと親リンクが同一でないと判定される場合は、図2Bの例示では、リンク表311の読出位置621がP1でリンク622がP4の場合である。図2Aの例示では、キー群140aの複数のキーについて、差分ビット位置による分類149bが実行される。
ステップS811の処理では、差分ビット位置表とリンク表が再設定され、ステップS801に戻る。そして、再設定された差分ビット位置表の親リンクの設定された差分ビット位置についての処理が繰り返される。
When it is determined in step S808 that the next link and the parent link are not the same, in the example of FIG. 2B, the reading position 621 of the link table 311 is P1 and the link 622 is P4. In the example of FIG. 2A, classification 149b based on difference bit positions is executed for a plurality of keys in the key group 140a.
In the process of step S811, the difference bit position table and the link table are reset, and the process returns to step S801. Then, the process for the set differential bit position of the parent link in the reset differential bit position table is repeated.

上述の処理を、ステップS802において、差分ビット位置表の全ての差分ビット位置のエントリについて処理済みである、と判定されるまで繰り返し、その判定が得られるとソート対象のキーのソートが完了しているので処理を終了する。   The above-described processing is repeated until it is determined in step S802 that processing has been completed for all the differential bit position entries in the differential bit position table. When the determination is obtained, sorting of the sorting target keys is completed. The process is terminated.

次に図9を参照して、図8に示すステップS811の処理を詳細に説明する。
図9は、本発明の一実施の形態における同一の差分ビット位置を有する複数のキーをさらに分類する処理の詳細な処理フロー例を説明する図である。
Next, with reference to FIG. 9, the process of step S811 shown in FIG. 8 will be described in detail.
FIG. 9 is a diagram for explaining a detailed processing flow example of processing for further classifying a plurality of keys having the same differential bit position in the embodiment of the present invention.

図9に示すように、ステップS901において、キー表より、次リンクの指すキーをソートキーとして取り出すとともに、次リンクをソートキーの読出位置に設定する。そして、ステップS902において、リンク表より次リンクの指すリンクを読み出して退避エリアに退避する。ステップS901における次リンクは、図8に示すステップS806において、リンク表より読み出された親リンクの指すリンクである。図2Bの例の差分ビット位置0を有するキーの分類処理であれば、親リンクがP1、次リンクがP4、そして次リンクの指すリンクであって退避エリアに退避されるリンクはP3である。   As shown in FIG. 9, in step S901, the key pointed to by the next link is extracted from the key table as a sort key, and the next link is set as the sort key reading position. In step S902, the link pointed to by the next link is read from the link table and saved in the save area. The next link in step S901 is a link indicated by the parent link read from the link table in step S806 shown in FIG. In the case of the classification processing of the key having the difference bit position 0 in the example of FIG. 2B, the parent link is P1, the next link is P4, and the link pointed to by the next link and saved in the save area is P3.

ステップS902において次リンクの指すリンクを退避する理由は、次のステップS903において、ステップS901で取り出したソートキーの、図8に示すステップS811で設定した基準キーに対する差分ビット位置に基づく分類処理が行われ、その結果としてリンク表の次リンクの指すリンクの値が書き換えられるので、あらかじめ退避しておいて、ステップS903以後の、次リンクの指すリンクを用いた処理を正常に行うためである。   The reason for saving the link pointed to by the next link in step S902 is that in the next step S903, the sort key based on the difference bit position of the sort key extracted in step S901 with respect to the reference key set in step S811 shown in FIG. 8 is performed. As a result, since the value of the link pointed to by the next link in the link table is rewritten, it is saved in advance and the processing using the link pointed to by the next link after step S903 is normally performed.

ステップS903では、図7A及び図7Bを参照して詳細に説明した、ソートキーと基準キーの差分ビット位置を得て、差分ビット位置によりソートキーを分類する処理が実行される。
そして、ステップS904において、次リンクと退避リンクは一致するか判定される。退避リンクが次リンクと一致すれば、同一差分ビット位置を有する分類対象となるキーは残っていないことから処理を終了する。
In step S903, the process of obtaining the difference bit position between the sort key and the reference key and classifying the sort key based on the difference bit position, which has been described in detail with reference to FIGS. 7A and 7B, is executed.
In step S904, it is determined whether the next link and the save link match. If the evacuation link matches the next link, the process ends because there are no remaining keys to be classified having the same differential bit position.

一方、ステップS904において、退避リンクが次リンクと一致しないと判定されると、ステップS905において退避リンクを次リンクに設定してステップS901に戻り、新しく設定された次リンクをキー表の読出位置とするキーを分類対象のソートキーとして分類処理を継続する。   On the other hand, if it is determined in step S904 that the save link does not match the next link, the save link is set as the next link in step S905, and the process returns to step S901. The newly set next link is set as the key table read position. The classification process is continued using the key to be sorted as the sort key to be classified.

上述のステップS901〜S905のループ処理を、退避リンクが次リンクと一致するまで、すなわち分類処理の対象となるキーがなくなるまで繰り返し、分類処理の対象となるキーがなくなると処理を終了する。   The loop processing in steps S901 to S905 described above is repeated until the save link matches the next link, that is, until there is no key to be classified, and the processing is ended when there is no key to be classified.

次に、図4に示すステップ411の処理の詳細を説明する。
図10は、本発明の一実施の形態における基準キーより大きいソートキーを差分ビット位置順に取り出す処理の処理フロー例を説明する図であり、図4に示すステップ411の処理の詳細を説明する図である。
Next, details of the processing in step 411 shown in FIG. 4 will be described.
FIG. 10 is a diagram for explaining a processing flow example of processing for extracting a sort key larger than the reference key in the order of difference bit positions according to the embodiment of the present invention, and is a diagram for explaining details of processing in step 411 shown in FIG. is there.

図8に示す、基準キーより小さいソートキーを差分ビット位置順に取り出す処理の処理フロー例と比較すると、図10に示す基準キーより大きいソートキーを差分ビット位置順に取り出す処理の処理フロー例は、ステップS1011の同一の差分ビット位置を有する複数キーをさらに分類する処理の詳細が図11に示すものであることを除いて、図8に示すものと同一である。したがって、図10に示す処理フロー例のこれ以上の説明は省略する。   Compared with the example of the processing flow for extracting the sort key smaller than the reference key shown in FIG. 8 in the order of the difference bit positions, the example of the processing flow for extracting the sort key larger than the reference key shown in FIG. The details of the process of further classifying a plurality of keys having the same differential bit position are the same as those shown in FIG. 8 except that the details are as shown in FIG. Therefore, further description of the processing flow example shown in FIG. 10 is omitted.

図11は、図10に示すステップS1103の処理の詳細を示すものであり、本発明の一実施の形態における同一の差分ビット位置を有する複数のキーをさらに分類する処理の詳細な処理フロー例を説明する図である。
図9と図11に示す同一の差分ビット位置を有する複数のキーをさらに分類する処理の詳細な処理フロー例を比較すると、同一の差分ビット位置を有する複数のキーをさらに分類する処理について、図9に示すステップS903の処理が基準キーより小さいソートキーと基準キーの差分ビット位置によりソートキーを分類するものであるのに対して、図11に示すステップS1103の処理は基準キーより大きいソートキーと基準キーの差分ビット位置によりソートキーを分類するものであることを除いて、同一である。
そして、図9に示すステップS903の処理の詳細は図7A及び図7Bに示すものであるのに対して、図11に示すステップS1103の処理の詳細は図6A及び図6Bに示すものである。したがって、図11に示す処理フロー例のこれ以上の説明は省略する。
FIG. 11 shows details of the processing in step S1103 shown in FIG. 10, and a detailed processing flow example of processing for further classifying a plurality of keys having the same differential bit position in one embodiment of the present invention. It is a figure explaining.
A detailed processing flow example of the process of further classifying a plurality of keys having the same difference bit position shown in FIG. 9 and FIG. 11 shows a process for further classifying a plurality of keys having the same difference bit position. While the process of step S903 shown in FIG. 9 classifies the sort key based on the difference bit position between the sort key and the reference key smaller than the reference key, the process of step S1103 shown in FIG. The sort keys are the same except that the sort keys are classified according to the difference bit positions.
The details of the process in step S903 shown in FIG. 9 are as shown in FIGS. 7A and 7B, whereas the details of the process in step S1103 shown in FIG. 11 are as shown in FIGS. 6A and 6B. Therefore, further description of the processing flow example shown in FIG. 11 is omitted.

図12は、本発明の一実施の形態におけるキーを降順に取り出すデータの流れを説明する図である。図12に例として示すものは、図2A及び図2Bの例示と同一のキーについて、基準キーより大きいキーと小さいキーのグループへの分類が行われた後の、基準キーより小さいキーのグループからキーを降順に取り出すデータの流れである。   FIG. 12 is a diagram for explaining the flow of data for extracting keys in descending order according to an embodiment of the present invention. As an example shown in FIG. 12, the same key as illustrated in FIGS. 2A and 2B is classified into a group of keys smaller than the reference key after classification into a group of keys larger than the reference key and smaller keys. This is a data flow for extracting keys in descending order.

図12の(a)に示すのは、差分ビット位置表310aとリンク表311に図2Bに示す初期値が設定され、最初のソート済みキー“1000”が取り出されてソート済みキー表313に格納された状態である。
差分ビット位置表310aは、図8に示す処理フロー例のとおり、差分ビット位置の降順でアクセスされる。
FIG. 12A shows the initial value shown in FIG. 2B in the difference bit position table 310 a and the link table 311, and the first sorted key “1000” is extracted and stored in the sorted key table 313. It is the state that was done.
The difference bit position table 310a is accessed in descending order of the difference bit positions as in the example of the processing flow shown in FIG.

先ず矢印682aで示す差分ビット位置611aが2であるエントリに格納された親リンクP2が読み出され、矢印672bで示すように、リンク表311の読出位置621がP2のエントリからリンク622であるP2が次リンクとして読み出される。そして、親リンクと次リンクはともにP2で同一であると判定されるので、矢印682bで示すキー表309の読出位置P2よりキー“1000”がソート済みキーとして取り出され、ソート済みキー表313のエントリ640dに格納される。 First, the parent link P2 stored in the entry whose differential bit position 611a indicated by the arrow 682a is 2 is read, and as indicated by the arrow 672b, the reading position 621 of the link table 311 is the link 622 from the entry of P2. Is read out as the next link. Since it is determined that both the parent link and the next link are the same at P2, the key “1000” is extracted as the sorted key from the reading position P2 of the key table 309 indicated by the arrow 682b, and the sorted key table 313 Stored in entry 640d.

次に矢印680aで示す差分ビット位置611aが0であるエントリに格納された親リンクP1が読み出され、矢印671bで示すように、リンク表311の読出位置621がP1のエントリからリンク622であるP4が次リンクとして読み出され、親リンクP1と次リンクP4は同一ではないと判定される。   Next, the parent link P1 stored in the entry in which the differential bit position 611a indicated by the arrow 680a is 0 is read, and the reading position 621 in the link table 311 is the link 622 from the entry of P1 as indicated by the arrow 671b. P4 is read as the next link, and it is determined that the parent link P1 and the next link P4 are not the same.

図12の(b)に示すのは、基準キー“1010”に対する差分ビット位置0のキーのグループの細分類において、その細分類における基準キー“0111”が取り出されてソート済みキー表313に格納され、細分類における基準キーにより差分ビット位置表とリンク表が再設定された状態である。   FIG. 12B shows the reference key “0111” in the sub-classification of the group of keys at the difference bit position 0 with respect to the reference key “1010”, and stores it in the sorted key table 313. The difference bit position table and the link table are reset by the reference key in the fine classification.

図12の(a)に示す差分ビット位置表310aの差分ビット位置611aが0であるエントリに格納された親リンクP1が指す、矢印681bで示すキー表309の読出位置P1よりキー“0111”が、点線の矢印681dで示すようにソート済みキー650bに取り出され、矢印681cで示すように、ソート済みキー表313のエントリ640cに格納される。   The key “0111” is read from the read position P1 of the key table 309 indicated by the arrow 681b indicated by the parent link P1 stored in the entry in which the difference bit position 611a of the difference bit position table 310a shown in FIG. As shown by a dotted arrow 681d, it is taken out into the sorted key 650b and stored in the entry 640c of the sorted key table 313 as shown by an arrow 681c.

一方、図12の(a)に示すリンク表311の、矢印674c、673cで示すリンク関係に基づいて、キー表309から読出位置P3、P4のキーが読み出され、ソート済みキー650bを基準キーとして差分ビット位置が再計算され、差分ビット位置表310aとリンク表311が再設定される   On the other hand, based on the link relationship indicated by arrows 674c and 673c in the link table 311 shown in FIG. 12A, the keys at the reading positions P3 and P4 are read from the key table 309, and the sorted key 650b is used as the reference key. As a result, the difference bit position is recalculated, and the difference bit position table 310a and the link table 311 are reset.

点線の矢印661aで示すように、キー表309の読出位置P3に格納されたキー“0010”の差分ビット位置は1であることから、差分ビット位置表310aの差分ビット位置611aが1であるエントリにはP3が設定される。同様に、点線の矢印663aで示すように、キー表309の読出位置P4に格納されたキー“0110”の差分ビット位置は3であることから、差分ビット位置表310aの差分ビット位置611aが3であるエントリにはP4が設定される。   As indicated by the dotted arrow 661a, the difference bit position of the key “0010” stored at the read position P3 of the key table 309 is 1, so that the difference bit position 611a of the difference bit position table 310a is 1. Is set to P3. Similarly, as indicated by the dotted arrow 663a, the difference bit position of the key “0110” stored at the read position P4 of the key table 309 is 3, so that the difference bit position 611a of the difference bit position table 310a is 3 Is set to P4.

また、差分ビット位置が1であるキーも差分ビット位置が3であるキーもそれぞれ1つであることから、矢印673b及び674bで示すように、リンク表311の読出位置621がP3、P4であるエントリのリンク622には、それぞれP3、P4が設定されている。   In addition, since there is one key having a difference bit position of 1 and one key having a difference bit position of 3, each read position 621 of the link table 311 is P3 and P4 as indicated by arrows 673b and 674b. P3 and P4 are set in the entry link 622, respectively.

図12の(c)に示すのは、キー表309の読出位置601がP3とP4であるエントリに格納されたキーがソート済みキー表313に格納され、基準キーより小さいキーのグループのソートが完了した状態である。 FIG. 12C shows that the keys stored in the entry whose reading positions 601 of the key table 309 are P3 and P4 are stored in the sorted key table 313, and the group of keys smaller than the reference key is sorted. It is in a completed state.

先ず矢印683aで示す差分ビット位置611aが3であるエントリに格納された親リンクP4が読み出され、矢印674bで示すように、リンク表311の読出位置621がP4のエントリからリンク622であるP4が次リンクとして読み出される。そして、親リンクと次リンクはともにP4で同一であると判定されるので、矢印684bで示すキー表309の読出位置P4よりキー“0110”がソート済みキーとして取り出され、ソート済みキー表313のエントリ640bに格納される。 First, the parent link P4 stored in the entry whose difference bit position 611a indicated by the arrow 683a is 3 is read, and as indicated by the arrow 674b, the reading position 621 of the link table 311 is the link 622 from the entry of P4. Is read out as the next link. Since it is determined that both the parent link and the next link are the same at P4, the key “0110” is extracted as the sorted key from the reading position P4 of the key table 309 indicated by the arrow 684b, and the sorted key table 313 Stored in entry 640b.

次に矢印681aで示す差分ビット位置611aが1であるエントリに格納された親リンクP3が読み出され、矢印673bで示すように、リンク表311の読出位置621がP3のエントリからリンク622であるP3が次リンクとして読み出される。そして、親リンクと次リンクはともにP3で同一であると判定されるので、矢印683bで示すキー表309の読出位置P3よりキー“0010”がソート済みキーとして取り出され、ソート済みキー表313のエントリ640aに格納される。
そして、差分ビット位置611aが0であるエントリには親リンクは設定されていないので、基準キーより小さいキーのグループのソートは完了する。
Next, the parent link P3 stored in the entry whose difference bit position 611a indicated by the arrow 681a is 1 is read, and the reading position 621 of the link table 311 is the link 622 from the entry of P3 as indicated by the arrow 673b. P3 is read as the next link. Since it is determined that both the parent link and the next link are the same at P3, the key “0010” is extracted as the sorted key from the reading position P3 of the key table 309 indicated by the arrow 683b, and the sorted key table 313 Stored in entry 640a.
Since the parent link is not set for the entry whose difference bit position 611a is 0, the sorting of the group of keys smaller than the reference key is completed.

以上本発明を実施するための形態について詳細に説明したが、本発明の実施の形態はそれに限ることなく種々の変形が可能であることは当業者に明らかである。
また、本発明のビット列データソート装置が、図2Bに例示するデータ構造を有するデータを記憶する記憶手段と図4に示す処理をコンピュータに実行させるプログラムによりコンピュータ上に構築可能なことは明らかである。
したがって、上記プログラム、及びプログラムを記録したコンピュータ読み取り可能な記録媒体は、本発明の実施の形態に含まれる。
以上詳細に説明した本発明が提供する新しいビット列データソート手法を用いることにより、より高速なビット列データのソートを行うことが可能となる。
Although the embodiment for carrying out the present invention has been described in detail above, it is obvious to those skilled in the art that the embodiment of the present invention is not limited thereto and can be variously modified.
In addition, it is obvious that the bit string data sorting apparatus of the present invention can be constructed on a computer by a storage unit that stores data having the data structure illustrated in FIG. 2B and a program that causes the computer to execute the processing illustrated in FIG. .
Therefore, the program and a computer-readable recording medium recording the program are included in the embodiment of the present invention.
By using the new bit string data sorting method provided by the present invention described in detail above, it is possible to sort bit string data at higher speed.

100 キー列
130 ソート済みキー列
149a、149b 差分ビット位置による分類
200 ビット列データソート装置
205 グループ分け手段
210 差分ビット位置計算手段
220 差分ビット位置分類手段
230 ソート済みキー出力手段
240 制御手段
301 データ処理装置
302 中央処理装置
303 キャッシュメモリ
304 バス
305 主記憶装置
306 外部記憶装置
307 通信装置
308 データ格納装置
309 キー表
310a、310b 差分ビット位置表
311 リンク表
313 ソート済みキー表
100 Key sequence 130 Sorted key sequence 149a, 149b Classification by difference bit position 200 Bit string data sort device 205 Grouping means 210 Difference bit position calculation means 220 Difference bit position classification means 230 Sorted key output means 240 Control means 301 Data processing apparatus 302 Central processing unit 303 Cache memory 304 Bus 305 Main storage unit 306 External storage unit 307 Communication unit 308 Data storage unit 309 Key table 310a, 310b Difference bit position table 311 Link table 313 Sorted key table

Claims (10)

ビット列で表されるソート対象のキーのソート処理を行うビット列データソート装置において、
前記ソート対象のキーを記憶するソート対象キー記憶手段と、
前記ソート対象のキー全体のうちの任意のキーである基準キーとソート対象キー記憶手段に記憶された該基準キー以外のキーとの大小比較により該基準キーより小さいキーのグループと大きいキーのグループのグループ分けを行うグループ分け手段と、
前記ソート対象キー記憶手段に記憶された前記ソート処理を構成する分類処理の分類対象である前記キーと、該分類対象であるキーのうち基準となるキーと、のビット列比較により、最初に異なるビット値となる差分ビット位置を求める差分ビット位置計算手段と、
前記差分ビット位置計算手段で求めた差分ビット位置毎に該差分ビット位置を有するキーの識別情報を記憶する分類対象キー差分ビット位置記憶手段と、
前記差分ビット位置計算手段で求めた前記差分ビット位置毎に該差分ビット位置を有するキーの識別情報を前記分類対象キー差分ビット位置記憶手段に書き込むことにより、前記分類対象であるキーを同一の差分ビット位置を有する組に分類する差分ビット位置分類手段と、
前記差分ビット位置分類手段で分類された同一の差分ビット位置を有するキーが1つの場合はそのキーを、同一の差分ビット位置を有するキーが複数の場合はそのうちの次の分類処理において基準となるキーをソート済みキーとして出力するソート済みキー出力手段と、
前記グループ分け手段、前記差分ビット位置計算手段、前記差分ビット位置分類手段及び前記ソート済みキー出力手段を制御する制御手段と、
を備え、
前記制御手段は、
最初の前記分類処理において、
前記グループ分け手段が、前記基準キーと前記基準キー以外のキーとの大小比較により該基準キーより小さいキーのグループと大きいキーのグループのグループ分けを行い、
前記差分ビット位置計算手段が、前記基準キーと該基準キー以外のキーの差分ビット位置を求め、
前記差分ビット位置分類手段が、前記基準キーより小さいキーのグループと大きいキーのグループ毎に、前記差分ビット位置計算手段が求めた前記差分ビット位置毎に該差分ビット位置を有するキーの識別情報を前記分類対象キー差分ビット位置記憶手段に書き込み、
以後の前記分類処理において、前記基準キーより小さいキーのグループと大きいキーのグループ毎に、
前記差分ビット位置計算手段が、前記差分ビット位置分類手段で分類された同一の差分ビット位置を有するキーを複数含むキーの組を前記分類対象として前記差分ビット位置を求めることを繰り返し、
前記差分ビット位置分類手段が、前記差分ビット位置計算手段が求めた差分ビット位置毎に同一の差分ビット位置を有する組に分類することを繰り返し、
前記ソート済みキー出力手段が、前記差分ビット位置分類手段が前記差分ビット位置毎に同一の差分ビット位置を有する組に分類するたびに、該同一の差分ビット位置を有するキーが1つの場合のキー及び前記基準となるキーをソート済みキーとして出力するために、
前記グループ分け手段、前記差分ビット位置計算手段、前記差分ビット位置分類手段及び前記ソート済みキー出力手段を制御すること、
を特徴とするビット列データソート装置。
In the bit string data sort device that performs the sort process of the key to be sorted represented by the bit string,
Sort target key storage means for storing the sort target key;
A group of keys smaller than the reference key and a group of keys larger than the reference key by comparing the reference key, which is an arbitrary key among the whole sort target keys, with a key other than the reference key stored in the sort target key storage unit Grouping means for grouping, and
The bit that is initially different by the bit string comparison between the key that is the classification target of the classification process that constitutes the sort process stored in the sort target key storage unit and the key that is the reference among the keys that are the classification target A difference bit position calculation means for obtaining a difference bit position as a value;
Classification target key difference bit position storage means for storing identification information of a key having the difference bit position for each difference bit position obtained by the difference bit position calculation means;
For each difference bit position obtained by the difference bit position calculation means, the identification information of the key having the difference bit position is written in the classification target key difference bit position storage means, so that the key to be classified is the same difference. Differential bit position classification means for classifying into sets having bit positions;
When there is one key having the same differential bit position classified by the differential bit position classification means, that key is used, and when there are a plurality of keys having the same differential bit position, it becomes a reference in the next classification process. Sorted key output means for outputting keys as sorted keys,
Control means for controlling the grouping means, the difference bit position calculation means, the difference bit position classification means and the sorted key output means;
With
The control means includes
In the first classification process,
The grouping means performs grouping of a group of keys smaller than the reference key and a group of larger keys by comparing the size of the reference key and a key other than the reference key;
The difference bit position calculation means obtains a difference bit position between the reference key and a key other than the reference key,
The difference bit position classification means includes identification information of a key having the difference bit position for each of the difference bit positions obtained by the difference bit position calculation means for each group of keys smaller and larger than the reference key. Write to the classification target key difference bit position storage means,
In the subsequent classification process, for each group of keys smaller and larger than the reference key,
The difference bit position calculation means repeatedly obtains the difference bit position as a classification target of a set of keys including a plurality of keys having the same difference bit position classified by the difference bit position classification means,
The difference bit position classification means repeats classifying into a set having the same difference bit position for each difference bit position obtained by the difference bit position calculation means,
Each time the sorted key output means classifies the difference bit position classification means into a set having the same difference bit position for each difference bit position, the key in the case where there is one key having the same difference bit position And to output the reference key as a sorted key,
Controlling the grouping means, the difference bit position calculation means, the difference bit position classification means and the sorted key output means;
A bit string data sorting device characterized by the above.
請求項1に記載のビット列データソート装置において、
前記基準キーを、前記ソート対象キー記憶手段から最初に読み込まれるキーとし、該基準キーより小さいキーのグループにおける前記分類対象であるキーのうち基準となるキーを最大の値をとる最大値キーとし、該基準キーより大きいキーのグループにおける前記分類対象であるキーのうち基準となるキーを最小の値をとる最小値キーとすることを特徴とするビット列データソート装置。
The bit string data sorting device according to claim 1,
The reference key is a key that is first read from the sort target key storage unit, and a key that is a reference among the keys to be classified in a group of keys smaller than the reference key is a maximum value key that takes a maximum value. A bit string data sorting device characterized in that a key serving as a reference among keys to be classified in a group of keys larger than the reference key is a minimum value key having a minimum value.
請求項2に記載のビット列データソート装置において、
前記キーを識別する情報は、該キーが記憶された前記ソート対象キー記憶手段における該キーのアドレスである読出位置であり、
前記分類対象キー差分ビット位置記憶手段は、前記基準キーより小さいキーのグループにおける前記分類対象であるキーと該分類対象であるキーのうち基準となるキーである前記最大値キーあるいは前記基準キーとの差分ビット位置毎に、該最大値キーあるいは前記基準キーに対する同一の差分ビット位置を有するキーのうち、最大のキーの前記読出位置である親リンクを格納する第1の差分ビット位置表と、前記基準キーより大きいキーのグループにおける前記分類対象であるキーと該分類対象であるキーのうち基準となるキーである前記最小値キーあるいは前記基準キーとの差分ビット位置毎に、該最小値キーあるいは前記基準キーに対する同一の差分ビット位置を有するキーのうち、最小のキーの前記読出位置である親リンクを格納する第2の差分ビット位置表と、前記読出位置毎に該読出位置のキーと前記同一の差分ビット位置を有するキーの読出位置であるリンクを格納するリンク表から構成されることを特徴とするビット列データソート装置。
In the bit string data sorting device according to claim 2,
The information for identifying the key is a reading position that is an address of the key in the sort target key storage unit in which the key is stored,
The classification target key difference bit position storage means includes the key to be classified in the group of keys smaller than the reference key and the maximum value key or the reference key that is a reference key among the keys to be classified. A first difference bit position table storing a parent link that is the reading position of the largest key among the keys having the same difference bit position with respect to the maximum value key or the reference key, for each difference bit position; The minimum value key for each difference bit position between the key to be classified in the group of keys larger than the reference key and the minimum value key to be a reference key among the keys to be classified or the reference key Alternatively, the parent link that is the reading position of the smallest key among the keys having the same differential bit position with respect to the reference key is stored. A bit string comprising a second difference bit position table and a link table storing a link which is a read position of the key having the same difference bit position as the key of the read position for each of the read positions Data sort device.
請求項3に記載のビット列データソート装置において、
前記同一の差分ビット位置を有するキーの前記ソート対象キー記憶手段の読出位置をリンク表の読出位置とするリンクは、該リンクをリンク表の読出位置とし、さらに該読出位置に設定されたリンクを順次たどることにより、前記同一の差分ビット位置を有する全てのキーの前記ソート対象キー記憶手段の読出位置を参照するために設定されており、該同一の差分ビット位置を有するキーのうちの最後のキーの読出位置のリンクには、該最後のキーの読出位置が格納されていることを特徴とするビット列データソート装置。
In the bit string data sorting device according to claim 3,
The link having the read position of the sort target key storage means of the key having the same differential bit position as the read position of the link table is the link as the read position of the link table, and the link set to the read position is It is set to refer to the read position of the sort target key storage means of all the keys having the same differential bit position by sequentially tracing the last of the keys having the same differential bit position. The bit string data sorting apparatus, wherein the key read position link stores the last key read position.
ビット列で表されるソート対象のキーのソート処理を行うビット列データソート方法において、
前記ソート対象のキーを記憶するソート対象キー記憶手段に前記ソート対象のキーを記憶するソート対象キー記憶ステップと、
前記ソート対象のキー全体のうちの任意のキーである基準キーとソート対象キー記憶手段に記憶された該基準キー以外のキーとの大小比較により該基準キーより小さいキーのグループと大きいキーのグループのグループ分けを行うグループ分けステップと、
前記ソート対象キー記憶手段に記憶された前記ソート処理を構成する分類処理の分類対象である前記キーと、該分類対象であるキーのうち基準となるキーと、のビット列比較により、最初に異なるビット値となる差分ビット位置を求める差分ビット位置計算ステップと、
前記差分ビット位置計算ステップで求めた差分ビット位置毎に、分類対象キー差分ビット位置記憶手段に該差分ビット位置を有するキーの識別情報を書き込むことにより、前記分類対象であるキーを同一の差分ビット位置を有する組に分類する差分ビット位置分類ステップと、
前記差分ビット位置分類ステップで分類された同一の差分ビット位置を有するキーが1つの場合はそのキーを、同一の差分ビット位置を有するキーが複数の場合はそのうちの次の分類処理において基準となるキーをソート済みキーとして出力するソート済みキー出力ステップと、
前記グループ分けステップ、前記差分ビット位置計算ステップ、前記差分ビット位置分類ステップ及び前記ソート済みキー出力ステップを制御する制御ステップと、
を備え、
前記制御ステップは、
最初の前記分類処理において、
前記グループ分けステップが、前記基準キーと前記基準キー以外のキーとの大小比較により該基準キーより小さいキーのグループと大きいキーのグループのグループ分けを行い、
前記差分ビット位置計算ステップが、前記基準キーと該基準キー以外のキーの差分ビット位置を求め、
前記差分ビット位置分類ステップが、前記基準キーより小さいキーのグループと大きいキーのグループ毎に、前記差分ビット位置計算ステップで求めた前記差分ビット位置毎に該差分ビット位置を有するキーの識別情報を前記分類対象キー差分ビット位置記憶手段に書き込み、
以後の前記分類処理において、前記基準キーより小さいキーのグループと大きいキーのグループ毎に、
前記差分ビット位置計算ステップが、前記差分ビット位置分類手段で分類された同一の差分ビット位置を有するキーを複数含むキーの組を前記分類対象として前記差分ビット位置を求めることを繰り返し、
前記差分ビット位置分類ステップが、前記差分ビット位置計算手段が求めた差分ビット位置毎に同一の差分ビット位置を有する組に分類することを繰り返し、
前記ソート済みキー出力ステップが、前記差分ビット位置分類ステップが前記差分ビット位置毎に同一の差分ビット位置を有する組に分類するたびに、該同一の差分ビット位置を有するキーが1つの場合のキー及び前記基準となるキーをソート済みキーとして出力するために、
前記グループ分けステップ、前記差分ビット位置計算ステップ、前記差分ビット位置分類ステップ及び前記ソート済みキー出力ステップを制御する、
ことを特徴とするビット列データソート方法。
In the bit string data sorting method for sorting the sort target key represented by the bit string,
A sort target key storage step of storing the sort target key in a sort target key storage means for storing the sort target key;
A group of keys smaller than the reference key and a group of keys larger than the reference key by comparing the reference key, which is an arbitrary key among the whole sort target keys, with a key other than the reference key stored in the sort target key storage unit A grouping step for grouping,
The bit that is initially different by the bit string comparison between the key that is the classification target of the classification process that constitutes the sort process stored in the sort target key storage unit and the key that is the reference among the keys that are the classification target A difference bit position calculation step for obtaining a difference bit position as a value;
For each difference bit position obtained in the difference bit position calculation step, the identification target key difference bit position storage means writes the identification information of the key having the difference bit position to make the key to be classified the same difference bit. A differential bit position classification step for classifying into sets having positions;
When there is one key having the same differential bit position classified in the differential bit position classification step, that key is used, and when there are a plurality of keys having the same differential bit position, it becomes a reference in the next classification process. A sorted key output step for outputting the key as a sorted key;
A control step for controlling the grouping step, the difference bit position calculation step, the difference bit position classification step, and the sorted key output step;
With
The control step includes
In the first classification process,
The grouping step performs grouping of a group of keys smaller than the reference key and a group of larger keys by comparing the size of the reference key and a key other than the reference key;
The difference bit position calculation step obtains a difference bit position between the reference key and a key other than the reference key,
In the differential bit position classification step, for each group of keys smaller and larger than the reference key, identification information of a key having the differential bit position for each differential bit position obtained in the differential bit position calculation step Write to the classification target key difference bit position storage means,
In the subsequent classification process, for each group of keys smaller and larger than the reference key,
The difference bit position calculation step repeats obtaining the difference bit position using a set of keys including a plurality of keys having the same difference bit position classified by the difference bit position classification means as the classification target,
The difference bit position classification step repeats classifying into a set having the same difference bit position for each difference bit position obtained by the difference bit position calculation means,
When the sorted key output step classifies the difference bit position classification step into a set having the same difference bit position for each difference bit position, the key in the case where there is one key having the same difference bit position And to output the reference key as a sorted key,
Controlling the grouping step, the difference bit position calculation step, the difference bit position classification step and the sorted key output step;
A bit string data sorting method characterized by the above.
請求項5に記載のビット列データソート方法において、
前記基準キーを、前記ソート対象キー記憶手段から最初に読み込まれるキーとし、該基準キーより小さいキーのグループにおける前記分類対象であるキーのうち基準となるキーを最大の値をとる最大値キーとし、該基準キーより大きいキーのグループにおける前記分類対象であるキーのうち基準となるキーを最小の値をとる最小値キーとすることを特徴とするビット列データソート方法。
The bit string data sorting method according to claim 5,
The reference key is a key that is first read from the sort target key storage unit, and a key that is a reference among the keys to be classified in a group of keys smaller than the reference key is a maximum value key that takes a maximum value. A bit string data sorting method characterized in that a reference key among the keys to be classified in a group of keys larger than the reference key is a minimum value key having a minimum value.
請求項6に記載のビット列データソート方法において、
前記キーを識別する情報は、該キーが記憶された前記ソート対象キー記憶手段における該キーのアドレスである読出位置であり、
前記分類対象キー差分ビット位置記憶手段は、前記基準キーより小さいキーのグループにおける前記分類対象であるキーと該分類対象であるキーのうち基準となるキーである前記最大値キーあるいは前記基準キーとの差分ビット位置毎に、該最大値キーあるいは前記基準キーに対する同一の差分ビット位置を有するキーのうち、最大のキーの前記読出位置である親リンクを格納する第1の差分ビット位置表と、前記基準キーより大きいキーのグループにおける前記分類対象であるキーと該分類対象であるキーのうち基準となるキーである前記最小値キーあるいは前記基準キーとの差分ビット位置毎に、該最小値キーあるいは前記基準キーに対する同一の差分ビット位置を有するキーのうち、最小のキーの前記読出位置である親リンクを格納する第2の差分ビット位置表と、前記読出位置毎に該読出位置のキーと前記同一の差分ビット位置を有するキーの読出位置であるリンクを格納するリンク表から構成されることを特徴とするビット列データソート方法。
The bit string data sorting method according to claim 6,
The information for identifying the key is a reading position that is an address of the key in the sort target key storage unit in which the key is stored,
The classification target key difference bit position storage means includes the key to be classified in the group of keys smaller than the reference key and the maximum value key or the reference key that is a reference key among the keys to be classified. A first difference bit position table storing a parent link that is the reading position of the largest key among the keys having the same difference bit position with respect to the maximum value key or the reference key, for each difference bit position; The minimum value key for each difference bit position between the key to be classified in the group of keys larger than the reference key and the minimum value key to be a reference key among the keys to be classified or the reference key Alternatively, the parent link that is the reading position of the smallest key among the keys having the same differential bit position with respect to the reference key is stored. A bit string comprising a second difference bit position table and a link table storing a link which is a read position of the key having the same difference bit position as the key of the read position for each of the read positions Data sorting method.
請求項7に記載のビット列データソート方法において、
前記同一の差分ビット位置を有するキーの前記ソート対象キー記憶手段の読出位置をリンク表の読出位置とするリンクは、該リンクをリンク表の読出位置とし、さらに該読出位置に設定されたリンクを順次たどることにより、前記同一の差分ビット位置を有する全てのキーの前記ソート対象キー記憶手段の読出位置を参照するために設定されており、該同一の差分ビット位置を有するキーのうちの最後のキーの読出位置のリンクには、該最後のキーの読出位置が格納されていることを特徴とするビット列データソート方法。
The bit string data sorting method according to claim 7,
The link having the read position of the sort target key storage means of the key having the same differential bit position as the read position of the link table is the link as the read position of the link table, and the link set to the read position is It is set to refer to the read position of the sort target key storage means of all the keys having the same differential bit position by sequentially tracing the last of the keys having the same differential bit position. The bit string data sorting method, wherein the key read position link stores the last key read position.
請求項5〜請求項8のいずれか1項に記載のビット列データソート方法をコンピュータに実行させるプログラム。   A program for causing a computer to execute the bit string data sorting method according to any one of claims 5 to 8. 請求項5〜請求項8のいずれか1項に記載のビット列データソート方法をコンピュータに実行させるプログラムを記憶したコンピュータ読み取り可能な記憶媒体。
A computer-readable storage medium storing a program for causing a computer to execute the bit string data sorting method according to any one of claims 5 to 8.
JP2009199115A 2008-12-22 2009-08-30 Bit string data sorting apparatus, method and program Expired - Fee Related JP5165654B2 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2009199115A JP5165654B2 (en) 2009-08-30 2009-08-30 Bit string data sorting apparatus, method and program
PCT/JP2010/004599 WO2011024376A1 (en) 2009-08-30 2010-07-15 Bit-string data sorting device, method and program
US13/067,722 US8515976B2 (en) 2008-12-22 2011-06-22 Bit string data sorting apparatus, sorting method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009199115A JP5165654B2 (en) 2009-08-30 2009-08-30 Bit string data sorting apparatus, method and program

Publications (3)

Publication Number Publication Date
JP2011048801A true JP2011048801A (en) 2011-03-10
JP2011048801A5 JP2011048801A5 (en) 2013-01-17
JP5165654B2 JP5165654B2 (en) 2013-03-21

Family

ID=43627498

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009199115A Expired - Fee Related JP5165654B2 (en) 2008-12-22 2009-08-30 Bit string data sorting apparatus, method and program

Country Status (2)

Country Link
JP (1) JP5165654B2 (en)
WO (1) WO2011024376A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4595995A (en) * 1983-02-17 1986-06-17 At&T Bell Laboratories Sort circuit and method using multiple parallel sorts of the sorted items
JPH04127321A (en) * 1990-09-19 1992-04-28 Fujitsu Ltd Sorting system by count classifying method utilizing relative key
JPH07302187A (en) * 1994-03-07 1995-11-14 Nippon Steel Corp Data sorting method and sorter
JP2010092088A (en) * 2008-10-03 2010-04-22 Nec Corp Ordering device, ordering method, and program
WO2010073471A1 (en) * 2008-12-22 2010-07-01 株式会社エスグランツ Bit string data sorting system, method, and program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4595995A (en) * 1983-02-17 1986-06-17 At&T Bell Laboratories Sort circuit and method using multiple parallel sorts of the sorted items
JPH04127321A (en) * 1990-09-19 1992-04-28 Fujitsu Ltd Sorting system by count classifying method utilizing relative key
JPH07302187A (en) * 1994-03-07 1995-11-14 Nippon Steel Corp Data sorting method and sorter
JP2010092088A (en) * 2008-10-03 2010-04-22 Nec Corp Ordering device, ordering method, and program
WO2010073471A1 (en) * 2008-12-22 2010-07-01 株式会社エスグランツ Bit string data sorting system, method, and program

Also Published As

Publication number Publication date
WO2011024376A1 (en) 2011-03-03
JP5165654B2 (en) 2013-03-21

Similar Documents

Publication Publication Date Title
Drew et al. Polymorphic malware detection using sequence classification methods
Riley et al. Computational thinking for the modern problem solver
US10489455B2 (en) Scoped search engine
US20140344195A1 (en) System and method for machine learning and classifying data
AU2015347304B2 (en) Testing insecure computing environments using random data sets generated from characterizations of real data sets
US8732173B2 (en) Classification hierarchy regeneration system, classification hierarchy regeneration method, and classification hierarchy regeneration program
CN107403075B (en) Comparison method, device and system
CN102346761A (en) Information processing device, related sentence providing method, and program
US20120209855A1 (en) Bit-string key classification/distribution apparatus, classification/distribution method, and program
CN107291895B (en) Quick hierarchical document query method
JP2019184852A (en) Data analysis server, data analysis system, and data analysis method
Najam et al. Pattern matching for DNA sequencing data using multiple bloom filters
US9715525B2 (en) Method and system for searching and storing data
Chakraborty et al. Performance comparison for data retrieval from nosql and sql databases: a case study for covid-19 genome sequence dataset
Khan et al. Set-based unified approach for attributed graph summarization
US20200278980A1 (en) Database processing apparatus, group map file generating method, and recording medium
JP4921453B2 (en) Bit string data sorting apparatus, method and program
CN110209780A (en) A kind of question template generation method, device, server and storage medium
CN103761298A (en) Distributed-architecture-based entity matching method
JP5165654B2 (en) Bit string data sorting apparatus, method and program
WO2015129109A1 (en) Index management device
JP5143797B2 (en) Bit string data sort device, sort method and program
JP2001022766A (en) Method and device for high speed processing for multidimensional database
JP6361472B2 (en) Correspondence information generation program, correspondence information generation apparatus, and correspondence information generation method
JP7422367B2 (en) Approximate string matching method and computer program for realizing the method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120727

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20121010

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121128

A871 Explanation of circumstances concerning accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A871

Effective date: 20121128

A975 Report on accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A971005

Effective date: 20121212

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20121218

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20121219

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20151228

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees