B + tree C ++ code release

Source: Internet
Author: User

B + tree C ++CodeRelease

 

Code: http://bluedog.download.csdn.net

 

Nothing can be said. The implementation of the C ++ template of the B + tree needs to be noted that

1. The key word of the master node is at the end of each leaf node.

2. Vals in a leaf node is not a set of values, but a set of value pointers, mainly to reduce the copy time during moving.

We also wanted to use keys as a collection of pointers, but there was a problem. If it was used as a database index, it had to read multiple pages.

Of course, keys is a value set and there will also be problems. For strings as keys, there will be an object copy problem.

Therefore, I think we need to implement two types of B + trees: value set and value pointer set,

Interested friends can discuss this, mail to xtlxs1976@163.com

3,AlgorithmThe book says that the B + tree is simpler than the B-tree, And it thinks that the deleted key can still be kept in the trunk. I think it may be used

Disk or database index management is reasonable, but as a complete algorithm, B + tree is much more complex than B-tree. For example, there are eight adjustments after deleting a key, b-trees only need to consider four types.

 

I was looking for a lot of data to test and started to write qqwry. there are about more than 0.3 million records in the latest version of the DAT conversion code, that is, the pure IP address database popular on the Internet. After writing the code, I found that the B + tree I wrote is of the value type, if the string is used as the key, it will be very slow and will not be tested. However, the conversion code of qqwry. dat is still very useful. In this rarfile, you can use what you need.

 

Well, it's still the same. If you find a bug or you areProgramThis class is used. Please send me a mail!

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.