The B tree I have implemented is the implementation of the B book algorithm on the "database system implementation". With the insertion method, I built a B index tree with the long-type data as a key value to the Object type data.
Description of my program:
(1) The meaning of the value range of the number of ingages is: I have to generate "to establish a meta number" in this program (here I use the Student class instead) and write into the file. The key value of each tuple is a random integer (not repeated), and the number of values is actually referred to as "the maximum value of the random generated key value". "
(2) The number of tuples to be established, also refers to the number of leaf nodes of the B tree (because each leaf is stored in a file pointer) [Description: I use RandomaccessFile to store the Yuan group, so Yuan Yuan Group file pointers are actually a long-type number]
(3) Number of keys that can accommodate each node - do not know how to see the definition of B tree
(4) The number of buckets: The purpose of introducing bucket is because it is necessary to generate a number of non-repetitive key values, to solve the problem of non-repetitive, the traditional comparative method is very large (O (N)), introduced the right amount Buckets can speed up the time of finding comparisons. I use HashSet as a bucket to achieve a quick setup of multiple non-repetitive key values. (Of course, if you don't have a small number of keys, you don't need a lot of buckets - please check the information about the container of the bucket)
(5) The value in the text box is the initial value I use, when you click "Reset", will display the value of our teacher's request.
(6) "Key value to find" means, you entered a key value, the program will be found in the book, and give the lookup path in the text box (printed the contents of the node), and finally give you the input The key value is in the tree.
(7) The program must be opened using the BAT file I will use, as this can open the console (command line), because the key value information in the generated tree and the hierarchical information of the tree will be displayed on the command line.
Put the B tree insertion:
In principle, in principle is the first: (1) Try to find the free space for the newly built in the appropriate leaf node, if any, where is the key value, (2) If there is no space in the appropriate leaf node, The leaf node is divided into two, and the keys in these two nodes are divided into these two nodes, so that each new node is half or just more than half of the keys. (3) Node splitting in a layer is equivalent to inserting a new button in this higher level - finger. Therefore, we can use this insert strategy at this higher level: if there is space, insert it; vice versa, split this into the node and continue the high level advancement of the unique. (4) The case is that if you try to insert the key to the node and there is no space with the node, split with the node into two nodes, create a new follow-up node in the next layer. This new nephew has two just split nodes as his child node.
Friendly Tip: All my code is generated by JB9, and the project file will be attached in the compression package. Since I recently watching "Reconstruction", some style in the code is learned from it, but I am still learning in the art, it is a bit uncomfortable, please forgive me. My total code is placed in my mailbox. I want to download it there, I am sorry, I will not upload the picture. After you download the program, you can see it:>
Gondam_f91@163.com Password is 012401030 If the program has bugs, or what is good suggestions, please reply, or send an email to my email, I will be very happy to discuss with you.