View the step-by-step solution to:

(Optional) Project B+ Tree Implementation Due Date: May, 20 2010 (Late submissions will NOT be accepted. Please do it on time!) In this project, you...

In this project, you will implement a B+ tree.
The order of the tree and the records to be inserted will be given as an argument to the application as following:
C:>BplusTree 2 records.txt
or, if you want to start with an empty tree:
C:>BplusTree 2
The leaf level pages of the contain entries of the form [key, rid of a data record] (Alternative 2 for data entries, in terms of the textbook). Through the application, you can simply think any record contains only the key field, as we did in all examples. You may use the node structure introduced in class (See the end of this document).
The implementation should contain a SIMPLE menu enabling the user to choose an action from the list of supported functions, which is listed below: Search: the user enters the key he/she would like to find. If the key is found in data file, print “KEY IS FOUND”, otherwise “KEY IS NOT FOUND”. Insert: the user enters the key to be inserted. In case it already exists in tree (in leaf nodes of course), message to the user “DUPLICATE ENTRIES ARE NOT ALLOWED”. If insertion succeeds prompt “INSERTION COMPLETED, SEE YOU NEXT TIME”.
In particular, your insert routine must be capable of dealing with overflows (at any level of the tree) by splitting pages. Note that it doesn’t mean that overflow is allowed in B+ tree structure. But, you must have space in any node to insert the new entry that will cause to split the node. That is, you must temporarily have (2*order +1) places to insert keys. When it is filled, you should split and redistribute the entries between siblings.Print to screen: this command prints the whole index. Though you can use any tree traversal method, I particularly would like to get PreOrder traversal results. Delete: the user enters the key to be deleted. The deletion procedure may result in decreasing the height of the tree, in this case the user should be warned “HEY, YOU CUT THE TREE”. Save: saves the index and data to the corresponding files. This is probably the most important function of your implementation as I will check these outputs for correctness of your application. The index file should contain your tree, and the nodes will appear in PreOrder form within the file. The data file is just a pile file, which needs to be created at the very beginning. Every time a record (key) is inserted, it is actually inserted into this file, and the rid value which appears in index is calculated using its position within the file. Quit: You have to allow the user to leave your application properly. So the complete view is:
C:>BplusTree 2
********Welcome to fatih’s B+Tree of version 3.2****
************What you would like to do?*************
****The brackets [ ] shows the compulsory fields****
1. Search [key]
2. Insert [key]
3. Delete [key]
4. Print Tree to Screen
5. Save [indexFileName][dataFileName]
6. Quit
Choice: 1 47
KEY IS NOT FOUND
THE TREE IS EMPTY
************What you would like to do?*************
****The brackets [ ] shows the compulsory fields****
1. Search [key]
2. Insert [key]
3. Delete [key]
4. Print Tree to Screen
5. Save [indexFileName][dataFileName]
6. Quit
Choice: 2 47

So the complete view is:
C:>BplusTree 2
********Welcome to emi’s B+Tree of version 3.2****
************What you would like to do?*************

****The brackets [ ] shows the compulsory fields****
1. Search [key]
2. Insert [key]
3. Delete [key]
4. Print Tree to Screen
5. Save [indexFileName][dataFileName]
6. Quit
Choice: 1 47
KEY IS NOT FOUND
THE TREE IS EMPTY
************What you would like to do?*************
****The brackets [ ] shows the compulsory fields****
1. Search [key]
2. Insert [key]
3. Delete [key]
4. Print Tree to Screen
5. Save [indexFileName][dataFileName]
6. Quit
Choice: 2 47

INSERTION COMPLETED, SEE YOU NEXT TIME
************What you would like to do?*************
****The brackets [ ] shows the compulsory fields****
1. Search [key]
2. Insert [key]
3. Delete [key]
4. Print Tree to Screen
5. Save [indexFileName][dataFileName]
6. Quit
Choice: 6
*******************************
Node structure:
typedef struct node {
void** pointers;
int* keys;
bool is_leaf;
int num_keys;
struct node* parent;
struct node* next; // Used for queue.
} node;
(Optional) Project B+ Tree Implementation Due Date: May, 20 2010 (Late submissions will NOT be accepted. Please do it on time!) The bearing of a child takes nine months, no matter how many women are assigned. (Referring to adding manpower to a software project.) Frederick P. Brooks In this project, you will implement a B+ tree. The order of the tree and the records to be inserted will be given as an argument to the application as following: C:\>BplusTree 2 records.txt or, if you want to start with an empty tree: C:\>BplusTree 2 The leaf level pages of the contain entries of the form [key, rid of a data record] (Alternative 2 for data entries, in terms of the textbook). Through the application, you can simply think any record contains only the key field, as we did in all examples. You may use the node structure introduced in class (See the end of this document). The implementation should contain a SIMPLE menu enabling the user to choose an action from the list of supported functions, which is listed below: Search: the user enters the key he/she would like to find. If the key is found in data file, print “KEY IS FOUND”, otherwise “KEY IS NOT FOUND”. Insert: the user enters the key to be inserted. In case it already exists in tree (in leaf nodes of course), message to the user “DUPLICATE ENTRIES ARE NOT ALLOWED”. If insertion succeeds prompt “INSERTION COMPLETED, SEE YOU NEXT TIME”. In particular, your insert routine must be capable of dealing with overflows (at any level of the tree) by splitting pages. Note that it doesn’t mean that overflow is allowed in B+ tree structure. But, you must have space in any node to insert the new entry that will cause to split the node. That is, you must temporarily have (2*order +1) places to insert keys. When it is filled, you should split and redistribute the entries between siblings. Print to screen: this command prints the whole index. Though you can use any tree traversal method, I particularly would like to get PreOrder traversal results. Delete: the user enters the key to be deleted. The deletion procedure may result in decreasing the height of the tree, in this case the user should be warned “HEY, YOU CUT THE TREE”. Save: saves the index and data to the corresponding files. This is probably the most important function of your implementation as I will check these outputs for correctness of your application. The index file should contain your tree, and the nodes will appear in PreOrder form within the file. The data file is just a pile file, which needs to be created at the very beginning. Every time a record (key) is inserted, it is actually inserted into this file, and the rid value which appears in index is calculated using its position within the file. Quit: You have to allow the user to leave your application properly.
Background image of page 1
(Optional) Project B+ Tree Implementation Due Date: May, 20 2010 (Late submissions will NOT be accepted. Please do it on time!) The bearing of a child takes nine months, no matter how many women are assigned. (Referring to adding manpower to a software project.) Frederick P. Brooks So the complete view is: C:\>BplusTree 2 ********Welcome to emi s B+Tree of version 3.2**** ************What you would like to do?************* ****The brackets [ ] shows the compulsory fields**** 1. Search [key] 2. Insert [key] 3. Delete [key] 4. Print Tree to Screen 5. Save [indexFileName][dataFileName] 6. Quit Choice: 1 47 KEY IS NOT FOUND THE TREE IS EMPTY ************What you would like to do?************* ****The brackets [ ] shows the compulsory fields**** 1. Search [key] 2. Insert [key] 3. Delete [key] 4. Print Tree to Screen 5. Save [indexFileName][dataFileName] 6. Quit Choice: 2 47 INSERTION COMPLETED, SEE YOU NEXT TIME ************What you would like to do?************* ****The brackets [ ] shows the compulsory fields**** 1. Search [key] 2. Insert [key] 3. Delete [key] 4. Print Tree to Screen 5. Save [indexFileName][dataFileName] 6. Quit Choice: 6 C:\> What to Submit You are expected to develop this project in C as a command line application. Regardless of the IDE you have been using, store all you source files (.c, .h, and makefile if exists), the records.txt file (which contains the test data to be provided), an index file, and a data file in the same folder. Zip them, and upload to the course online.
Background image of page 2
Show entire document

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question