JPS628226A - File key search method - Google Patents
File key search methodInfo
- Publication number
- JPS628226A JPS628226A JP60147540A JP14754085A JPS628226A JP S628226 A JPS628226 A JP S628226A JP 60147540 A JP60147540 A JP 60147540A JP 14754085 A JP14754085 A JP 14754085A JP S628226 A JPS628226 A JP S628226A
- Authority
- JP
- Japan
- Prior art keywords
- key
- search
- file
- record
- records
- 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.)
- Pending
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
(57)【要約】本公報は電子出願前の出願データであるた
め要約のデータは記録されません。(57) [Summary] This bulletin contains application data before electronic filing, so abstract data is not recorded.
Description
【発明の詳細な説明】
産業上の利用分野
本発明は、キーを持つレコードを2分割法とキーを変数
とする近似式を用いることにより探し出す、ファイルの
キー検索方法に関するものである。DETAILED DESCRIPTION OF THE INVENTION Field of Industrial Application The present invention relates to a file key search method for searching for a record having a key by using the two-part method and an approximate expression using the key as a variable.
従来の技術
近年、ファイルのキー検索方法としては、ファイルの先
頭から順に読んで行く方法、キー値より乱数を発生させ
、その乱数から位置を決めて読み込む方法、キーの大小
比較を繰り返しデータを絞り込んで行く2分割法、2レ
コードのキー値と相対位置から一次方程式を導出し、こ
れより相対位置を求める近似法が一般に採用されている
。Conventional technology In recent years, file key search methods include reading the file sequentially from the beginning, generating random numbers from the key value, determining the position from the random number and reading, and repeatedly comparing the size of the keys to narrow down the data. Generally, the two-division method is used, and the approximation method is used in which a linear equation is derived from the key values and relative positions of the two records, and the relative positions are determined from this.
以下、図面を参照しながら、上述した従来のファイルの
キー検索方法の二側について説明する。Hereinafter, two aspects of the conventional file key search method described above will be described with reference to the drawings.
第3図は従来のファイルのキー検索方法の一例である2
分割法を示すものである。第3図において、黒丸はそれ
ぞれレコードの相対番号とキー値をあられしている。以
下その動作について説明する。Figure 3 is an example of a conventional file key search method2.
This shows the division method. In FIG. 3, each black circle indicates the relative number and key value of the record. The operation will be explained below.
検索キーが40の場合を考える。まず相対番号が中央で
あるレコード5のキー値70と比較を行う。Consider a case where the search key is 40. First, a comparison is made with the key value 70 of record 5 whose relative number is in the middle.
検索キーの方が小さいので、以降相対番号1から4のレ
コードに対して同様の検索を行い、3回目の比較で検索
レコード相対番号3を見つける。Since the search key is smaller, similar searches are subsequently performed for records with relative numbers 1 to 4, and search record relative number 3 is found in the third comparison.
第4図は従来のファイルのキー検索方法のもう一つの例
である一次方程式近似法を示すものである。第4図にお
いて、黒丸は第3図と同様レコードの相対番号とキー値
をあられしている。以下、その動作について説明する。FIG. 4 shows a linear equation approximation method, which is another example of the conventional file key search method. In FIG. 4, black circles indicate relative numbers and key values of records, as in FIG. 3. The operation will be explained below.
検索キーが50の場合を考える。この方式では相対番号
lと9の点を直線で結び、キー値50より垂線を立てる
。この垂線と直線の交点Aからの水平線と縦軸の交点は
相対番号3に一番近い。そこで相対番号3のキー値を見
るとキー値は90となり一致しない。次に相対番号1と
3の点を直線で結び、同様の操作を行なう。そして相対
番号2なる求めるレコードが検索される。Consider a case where the search key is 50. In this method, the relative numbers l and 9 are connected with a straight line, and a perpendicular line is drawn from the key value 50. The intersection of the horizontal line and the vertical axis from the intersection point A of this perpendicular line and the straight line is closest to relative number 3. Then, when looking at the key value of relative number 3, the key value is 90, which does not match. Next, connect the points with relative numbers 1 and 3 with a straight line and perform the same operation. Then, the desired record with relative number 2 is searched.
発明が解決しようとする問題点
しかしながら、上記のような方法では2分割法では最悪
のケースを低(抑えられるが、必ずしも最小回数で検索
できないし、−次式での近似法ではキー値が一次式から
極端にかけ離れている場合に効率が悪くなるという問題
点を有していた。Problems to be Solved by the Invention However, in the method described above, the worst case can be suppressed by the two-part method, but it is not necessarily possible to search for the minimum number of times, and the approximation method using the following formula There was a problem in that efficiency deteriorated when the equation was extremely different from the equation.
本発明は上記問題点に鑑み、検索効率のよい、ファイル
のキー検索方法を提供するものである。In view of the above problems, the present invention provides a file key search method with high search efficiency.
問題点を解決するための手段
上記問題点を解決するため本発明のファイルのキー検索
方法は、上記2分割法と1次方程式からの近似法を組み
合わせて用いることにより目的のレコードを探し出すも
のである。Means for Solving the Problems In order to solve the above problems, the file key search method of the present invention searches for the target record by using a combination of the above two-division method and the approximation method from linear equations. be.
作用
本発明は上記したごとく、検索レコードのキーが指定さ
れると、該当ファイルからレコードを探し出すのに対象
レコード中の相対番号の中央値のキー値と検索キーを比
較していく2分割法と、対象レコード中の相対番号の両
端を通る一次方程式から推定していく近似法とを組み合
わせることでレコードを検索することを特徴とするファ
イルのキー検索方法である。As described above, when the key of a search record is specified, the present invention uses a two-part method to search for a record from a corresponding file by comparing the key value of the median relative number in the target record with the search key. This is a file key search method characterized by searching for records by combining this method with an approximation method that estimates from a linear equation that passes through both ends of the relative number in the target record.
実施例
以下本発明の一実施例のファイルのキー検索方法につい
て、図面を参照しながら説明する。 −第1図は本発明
の実施例におけるファイルのキー検索方法の機能を示す
ものである。第1図において、黒丸は相対番号とキー値
をあられしている。Embodiment Hereinafter, a file key search method according to an embodiment of the present invention will be described with reference to the drawings. - FIG. 1 shows the function of a file key search method in an embodiment of the present invention. In FIG. 1, black circles indicate relative numbers and key values.
この例は最初の検索に2分割法を適用し、以降の検索に
一次方程式の近似法を用いている。検索キーが100の
場合を考える。まず2分割法に従って相対番号の中央値
8のレコードを検索する。キー(! 140 (>10
0)なので相対番号1と8を直線で結びキー値100の
点より垂線を立てる。直線と垂線の交点からの水平線と
縦軸の交点は相対番号6に最も近い。そこで相対番号6
のキー値を見ると120となり一致しない。次に相対番
号1と6を直線で結び同様の操作をナテない、以下同様
に繰り返していくと相対番号4のレコードのキー値がl
OOとなり求めるレコードが検索できた。In this example, the two-part method is applied to the first search, and the linear equation approximation method is used for subsequent searches. Consider a case where the search key is 100. First, records with a median relative number of 8 are searched according to the 2-division method. Key (! 140 (>10
0), so connect relative numbers 1 and 8 with a straight line and draw a perpendicular line from the point of key value 100. The intersection of the horizontal line and the vertical axis from the intersection of the straight line and the perpendicular line is closest to relative number 6. So relative number 6
Looking at the key value, it is 120, which does not match. Next, connect relative numbers 1 and 6 with a straight line and repeat the same operation, and the key value of the record with relative number 4 will be l.
OO and was able to search for the desired record.
第2図は本発明を実施するためのシステム構成を説明す
る図である。第2図において1はファイル、2はキー検
索機構、3は応用プログラムである。応用プログラムは
、レコードの読み出しをキー検索機構に依転する。キー
検索機構は第1図で示した方式によってファイルにアク
セスし、該当キーを持つレコードの相対番号を応用プロ
グラムに引き渡す。FIG. 2 is a diagram illustrating a system configuration for implementing the present invention. In FIG. 2, 1 is a file, 2 is a key search mechanism, and 3 is an application program. The application program relies on the key search mechanism to read records. The key search mechanism accesses the file using the method shown in FIG. 1 and passes the relative number of the record having the relevant key to the application program.
発明の効果
以上のように本発明はレコードがキーの順番に並んだフ
ァイルから、特定のキーのレコードを検索するうえで、
2分割法と一次方程式による近似法を組み合わせて用い
ることにより、レコードの検索効率を向上することがで
きる。Effects of the Invention As described above, the present invention enables searching for a record with a specific key from a file in which records are arranged in the order of keys.
By using a combination of the two-division method and the linear equation approximation method, it is possible to improve record search efficiency.
第1図は本発明の一実施例における処理を示す図、第2
図は本発明を実施するためのシステム構成を示す図、第
3図及び第4図は従来の実施例における処理の例を示す
図である。
l・・・・・・ファイル、2・・・・・・キー検索機構
、3・・・・・・応用プログラム。
代理人の氏名 弁理士 中尾敏男 はか1名第 1 図
3−m一応用7°ログラム
第 3 図
第4図FIG. 1 is a diagram showing processing in an embodiment of the present invention, and FIG.
The figure shows a system configuration for implementing the present invention, and FIGS. 3 and 4 are diagrams showing examples of processing in a conventional embodiment. l...File, 2...Key search mechanism, 3...Application program. Name of agent Patent attorney Toshio Nakao Number 1 Figure 3-m-Applied 7° program Figure 3 Figure 4
Claims (1)
指定のキーを持つレコードを検索する方法において、指
定キーとファイル中の真中に位置するレコードのキーと
の大小比較を繰り返す2分割法と、2つのレコードのキ
ー値と相対位置に基づく一次方程式から目的レコードの
相対位置を推定する方式を組み合わせることにより、目
的レコードを探し出すことを特徴とするファイルのキー
検索方法。In a method of searching for a record with a specified key from a file in which records are stored in the order of a specific key, there are two methods: 2) repeating a size comparison between the specified key and the key of the record located in the middle of the file; A file key search method characterized by searching for a target record by combining a method of estimating the relative position of the target record from a linear equation based on the key value and relative position of two records.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP60147540A JPS628226A (en) | 1985-07-04 | 1985-07-04 | File key search method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP60147540A JPS628226A (en) | 1985-07-04 | 1985-07-04 | File key search method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPS628226A true JPS628226A (en) | 1987-01-16 |
Family
ID=15432626
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP60147540A Pending JPS628226A (en) | 1985-07-04 | 1985-07-04 | File key search method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPS628226A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH04199364A (en) * | 1990-11-29 | 1992-07-20 | Hitachi Ltd | Retrieval method with fuzziness |
-
1985
- 1985-07-04 JP JP60147540A patent/JPS628226A/en active Pending
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH04199364A (en) * | 1990-11-29 | 1992-07-20 | Hitachi Ltd | Retrieval method with fuzziness |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JPS628226A (en) | File key search method | |
| CN110110024B (en) | Method for importing high-capacity VCT file into spatial database | |
| JPH0518148B2 (en) | ||
| JPH02289005A (en) | Alignment processing system for count information | |
| JP2943693B2 (en) | Sort work file space management method | |
| JPH06215044A (en) | Information retrieval processor | |
| JP2958005B2 (en) | How to access unevenly spaced data files | |
| JPH05173742A (en) | Message data managing system | |
| JPS6225346A (en) | Electronic journal file constitution system | |
| JPH03276258A (en) | Exclusive control method in data retrieval system | |
| JP2001101233A (en) | Database processing unit | |
| JPS63148349A (en) | Cache memory positioning system | |
| JPH1173353A (en) | Transaction retrieval processor based on specified time | |
| JPH0452967A (en) | And operation processing system for set file | |
| JP2616203B2 (en) | Management method of name table in translation system | |
| JP2724235B2 (en) | Variable name inference device | |
| JPH05334354A (en) | Method for reading-in index organization file | |
| JPH04350741A (en) | Access speed increasing method for indexed sequential file | |
| JPS6339029A (en) | Production of data base | |
| JPH0793129A (en) | Sort system | |
| JPS63118989A (en) | graphic display device | |
| JPH04137176A (en) | Circuit diagram conversion device | |
| JPH02178851A (en) | File open processing system | |
| JPS63148326A (en) | Data coupling device | |
| JPH02176866A (en) | Fast search method |